-
Notifications
You must be signed in to change notification settings - Fork 0
/
Piece.swift
57 lines (34 loc) · 1.07 KB
/
Piece.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Piece.swift
// Prhymer
//
// Created by Thomas Lisankie on 6/28/16.
// Copyright © 2016 Shaken Earth. All rights reserved.
//
import Foundation
@objc(Piece)
class Piece : NSObject, NSCoding {
var title: String?;
var content: String?;
//date of creation
init(title: String){
self.title = title;
content = "";
}
required init(coder aDecoder: NSCoder) {
if let title = aDecoder.decodeObject(forKey: "title") as? String {
self.title = title;
}
if let content = aDecoder.decodeObject(forKey: "content") as? String {
self.content = content;
}
}
func encode(with aCoder: NSCoder) {
if let title = self.title {
aCoder.encode(title, forKey: "title")
}
if let content = self.content {
aCoder.encode(content, forKey: "content")
}
}
}