Skip to content

Commit 417779b

Browse files
committed
Update Xcode templates
1 parent e2e90bb commit 417779b

18 files changed

+140
-143
lines changed
3.24 KB
Binary file not shown.
4.85 KB
Binary file not shown.

tools/templates/codesnippets/WCDB.ColumnCodableClass.Data.swift.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<string>All</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>class &lt;#Class name#&gt;: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
12+
<string>class &lt;#Class name#&gt;: WCDB.ColumnCodable, WCDB.LiteralValueConvertible, WCDB.ExpressionCanBeOperated {
1313
static var columnType: ColumnType {
1414
return .BLOB
1515
}
1616

17-
required init?(with value: FundamentalValue) {
17+
required init?(with value: WCDB.Value) {
1818
&lt;#init with value.dataValue#&gt;
1919
}
2020

21-
func archivedValue() -&gt; FundamentalValue {
22-
return FundamentalValue(&lt;#Data#&gt;)
21+
func archivedValue() -&gt; WCDB.Value {
22+
return WCDB.Value(&lt;#Data#&gt;)
2323
}
2424
}
2525
</string>

tools/templates/codesnippets/WCDB.ColumnCodableClass.Double.swift.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<string>All</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>class &lt;#Class name#&gt;: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
12+
<string>class &lt;#Class name#&gt;: WCDB.ColumnCodable, WCDB.LiteralValueConvertible, WCDB.ExpressionCanBeOperated {
1313
static var columnType: ColumnType {
1414
return .float
1515
}
1616

17-
required init?(with value: FundamentalValue) {
17+
required init?(with value: WCDB.Value) {
1818
&lt;#init with value.doubleValue#&gt;
1919
}
2020

21-
func archivedValue() -&gt; FundamentalValue {
22-
return FundamentalValue(&lt;#Double#&gt;)
21+
func archivedValue() -&gt; WCDB.Value {
22+
return WCDB.Value(&lt;#Double#&gt;)
2323
}
2424
}
2525
</string>

tools/templates/codesnippets/WCDB.ColumnCodableClass.Int32.swift.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<string>All</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>class &lt;#Class name#&gt;: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
12+
<string>class &lt;#Class name#&gt;: WCDB.ColumnCodable, WCDB.LiteralValueConvertible, WCDB.ExpressionCanBeOperated {
1313
static var columnType: ColumnType {
1414
return .integer32
1515
}
1616

17-
required init?(with value: FundamentalValue) {
17+
required init?(with value: WCDB.Value) {
1818
&lt;#init with value.int32Value#&gt;
1919
}
2020

21-
func archivedValue() -&gt; FundamentalValue {
22-
return FundamentalValue(&lt;#Int32#&gt;)
21+
func archivedValue() -&gt; WCDB.Value {
22+
return WCDB.Value(&lt;#Int32#&gt;)
2323
}
2424
}
2525
</string>

tools/templates/codesnippets/WCDB.ColumnCodableClass.Int64.swift.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<string>All</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>class &lt;#Class name#&gt;: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
12+
<string>class &lt;#Class name#&gt;: WCDB.ColumnCodable, WCDB.LiteralValueConvertible, WCDB.ExpressionCanBeOperated {
1313
static var columnType: ColumnType {
1414
return .integer64
1515
}
1616

17-
required init?(with value: FundamentalValue) {
17+
required init?(with value: WCDB.Value) {
1818
&lt;#init with value.int64Value#&gt;
1919
}
2020

21-
func archivedValue() -&gt; FundamentalValue {
22-
return FundamentalValue(&lt;#Int64#&gt;)
21+
func archivedValue() -&gt; WCDB.Value {
22+
return WCDB.Value(&lt;#Int64#&gt;)
2323
}
2424
}
2525
</string>

tools/templates/codesnippets/WCDB.ColumnCodableClass.String.swift.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<string>All</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>class &lt;#Class name#&gt;: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
12+
<string>class &lt;#Class name#&gt;: WCDB.ColumnCodable, WCDB.LiteralValueConvertible, WCDB.ExpressionCanBeOperated {
1313
static var columnType: ColumnType {
1414
return .text
1515
}
1616

17-
required init?(with value: FundamentalValue) {
17+
required init?(with value: WCDB.Value) {
1818
&lt;#init with value.stringValue#&gt;
1919
}
2020

21-
func archivedValue() -&gt; FundamentalValue {
22-
return FundamentalValue(&lt;#String#&gt;)
21+
func archivedValue() -&gt; WCDB.Value {
22+
return WCDB.Value(&lt;#String#&gt;)
2323
}
2424
}
2525
</string>

tools/templates/codesnippets/WCDB.TableCodableClass.swift.codesnippet

+17-31
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,36 @@
99
<string>All</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>class &lt;#Class name#&gt;: WCDBSwift.TableCodable {
12+
<string>class &lt;#Class name#&gt;: WCDB.TableCodable {
1313
//Your own properties
14-
var variable1: Int = 0
14+
var variable1: Int = 0
1515
var variable2: String? // Optional if it would be nil in some WCDB selection.
1616
var variable3: Double? // Optional if it would be nil in some WCDB selection.
1717
let invalid: Int = 0 // An initialized constant property is not allowed.
1818
let unbound: Date? = nil
1919

2020
enum CodingKeys: String, CodingTableKey {
21-
typealias Root = &lt;#Class name#&gt;
21+
typealias Root = Temp;
2222

2323
//List the properties which should be bound to table.
2424
case variable1 = "custom_name"
2525
case variable2
2626
case variable3
2727

28-
static let objectRelationalMapping = TableBinding(CodingKeys.self)
29-
30-
//Column constraints for primary key, unique, not null, default value and so on. It is optional.
31-
//static var columnConstraintBindings: [CodingKeys: ColumnConstraintBinding]? {
32-
// return [
33-
// .variable1: ColumnConstraintBinding(isPrimary: true, isAutoIncrement: true),
34-
// .variable2: ColumnConstraintBinding(isUnique: true)
35-
// ]
36-
//}
37-
38-
//Index bindings. It is optional.
39-
//static var indexBindings: [IndexBinding.Subfix: IndexBinding]? {
40-
// return [
41-
// "_index": IndexBinding(indexesBy: CodingKeys.variable2)
42-
// ]
43-
//}
44-
45-
//Table constraints for multi-primary, multi-unique and so on. It is optional.
46-
//static var tableConstraintBindings: [TableConstraintBinding.Name: TableConstraintBinding]? {
47-
// return [
48-
// "MultiPrimaryConstraint": MultiPrimaryBinding(indexesBy: variable2.asIndex(orderBy: .descending), variable3.primaryKeyPart2)
49-
// ]
50-
//}
51-
52-
//Virtual table binding for FTS and so on. It is optional.
53-
//static var virtualTableBinding: VirtualTableBinding? {
54-
// return VirtualTableBinding(with: .fts3, and: ModuleArgument(with: .WCDB))
55-
//}
28+
static let objectRelationalMapping = TableBinding(CodingKeys.self) {
29+
//Column constraints for primary key, unique, not null, default value and so on. It is optional.
30+
//BindColumnConstraint(.variable1, isPrimary: true, isAutoIncrement: true)
31+
//BindColumnConstraint(.variable2, isUnique: true)
32+
33+
//Index bindings. It is optional.
34+
//BindIndex(.variable2, namedWith: "_index")
35+
36+
//Table constraints for multi-primary, multi-unique and so on. It is optional.
37+
//BindMultiPrimary(.variable2, .variable3)
38+
39+
//Virtual table binding for FTS and so on. It is optional.
40+
//BindVirtualTable(withModule: .FTS5, and: BuiltinTokenizer.Verbatim)
41+
}
5642
}
5743

5844
//Properties below are needed when the primary key is auto-increment.
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// ___FILEHEADER___
22

33
import Foundation
4-
import WCDBSwift
4+
import WCDB
55

6-
class ___VARIABLE_productName___: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
6+
class ___VARIABLE_productName___: WCDB.ColumnCodable, WCDB.LiteralValueConvertible {
77
static var columnType: ColumnType {
88
return .BLOB
99
}
1010

11-
required init?(with value: FundamentalValue) {
11+
required init?(with value: WCDB.Value) {
1212
/* <#Init ___VARIABLE_productName___ From value.dataValue#> */
1313
}
1414

15-
func archivedValue() -> FundamentalValue {
16-
return FundamentalValue(<#Data#>)
15+
func archivedValue() -> WCDB.Value {
16+
return WCDB.Value(<#Data#>)
1717
}
1818
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// ___FILEHEADER___
22

33
import Foundation
4-
import WCDBSwift
4+
import WCDB
55

6-
class ___VARIABLE_productName___: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
6+
class ___VARIABLE_productName___: WCDB.ColumnCodable, WCDB.LiteralValueConvertible {
77
static var columnType: ColumnType {
88
return .float
99
}
1010

11-
required init?(with value: FundamentalValue) {
11+
required init?(with value: WCDB.Value) {
1212
/* Init ___VARIABLE_productName___ From value.doubleValue */
1313
}
1414

15-
func archivedValue() -> FundamentalValue {
16-
return FundamentalValue(<#Double#>)
15+
func archivedValue() -> WCDB.Value {
16+
return WCDB.Value(<#Double#>)
1717
}
1818
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// ___FILEHEADER___
22

33
import Foundation
4-
import WCDBSwift
4+
import WCDB
55

6-
class ___VARIABLE_productName___: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
6+
class ___VARIABLE_productName___: WCDB.ColumnCodable, WCDB.LiteralValueConvertible {
77
static var columnType: ColumnType {
88
return .integer32
99
}
1010

11-
required init?(with value: FundamentalValue) {
11+
required init?(with value: WCDB.Value) {
1212
/* Init ___VARIABLE_productName___ From value.int32Value */
1313
}
1414

15-
func archivedValue() -> FundamentalValue {
16-
return FundamentalValue(<#Int32#>)
15+
func archivedValue() -> WCDB.Value {
16+
return WCDB.Value(<#Int32#>)
1717
}
1818
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// ___FILEHEADER___
22

33
import Foundation
4-
import WCDBSwift
4+
import WCDB
55

6-
class ___VARIABLE_productName___: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
6+
class ___VARIABLE_productName___: WCDB.ColumnCodable, WCDB.LiteralValueConvertible {
77
static var columnType: ColumnType {
88
return .BLOB
99
}
1010

11-
required init?(with value: FundamentalValue) {
11+
required init?(with value: WCDB.Value) {
1212
/* Init ___VARIABLE_productName___ From value.int64Value */
1313
}
1414

15-
func archivedValue() -> FundamentalValue {
16-
return FundamentalValue(<#Int64#>)
15+
func archivedValue() -> WCDB.Value {
16+
return WCDB.Value(<#Int64#>)
1717
}
1818
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// ___FILEHEADER___
22

33
import Foundation
4-
import WCDBSwift
4+
import WCDB
55

6-
class ___VARIABLE_productName___: WCDBSwift.ColumnCodable, WCDBSwift.LiteralValueConvertible, WCDBSwift.ExpressionCanBeOperated {
6+
class ___VARIABLE_productName___: WCDB.ColumnCodable, WCDB.LiteralValueConvertible {
77
static var columnType: ColumnType {
88
return .text
99
}
1010

11-
required init?(with value: FundamentalValue) {
11+
required init?(with value: WCDB.Value) {
1212
/* Init ___VARIABLE_productName___ From value.stringValue */
1313
}
1414

15-
func archivedValue() -> FundamentalValue {
16-
return FundamentalValue(<#String#>)
15+
func archivedValue() -> WCDB.Value {
16+
return WCDB.Value(<#String#>)
1717
}
1818
}

tools/templates/xctemplates/WCDB/TableCodable.xctemplate/Swift/___FILEBASENAME___.swift

+16-30
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// ___FILEHEADER___
22

33
import Foundation
4-
import WCDBSwift
4+
import WCDB
55

6-
class ___VARIABLE_productName___: WCDBSwift.TableCodable {
6+
class ___VARIABLE_productName___: WCDB.TableCodable {
77
// Your own properties
88
var variable1: Int = 0
99
var variable2: String? // Optional if it would be nil in some WCDB selection.
@@ -19,34 +19,20 @@ class ___VARIABLE_productName___: WCDBSwift.TableCodable {
1919
case variable2
2020
case variable3
2121

22-
static let objectRelationalMapping = TableBinding(CodingKeys.self)
23-
24-
// Column constraints for primary key, unique, not null, default value and so on. It is optional.
25-
// static var columnConstraintBindings: [CodingKeys: ColumnConstraintBinding]? {
26-
// return [
27-
// .variable1: ColumnConstraintBinding(isPrimary: true, isAutoIncrement: true),
28-
// .variable2: ColumnConstraintBinding(isUnique: true)
29-
// ]
30-
// }
31-
32-
// Index bindings. It is optional.
33-
// static var indexBindings: [IndexBinding.Subfix: IndexBinding]? {
34-
// return [
35-
// "_index": IndexBinding(indexesBy: CodingKeys.variable2)
36-
// ]
37-
// }
38-
39-
// Table constraints for multi-primary, multi-unique and so on. It is optional.
40-
// static var tableConstraintBindings: [TableConstraintBinding.Name: TableConstraintBinding]? {
41-
// return [
42-
// "MultiPrimaryConstraint": MultiPrimaryBinding(indexesBy: variable2.asIndex(orderBy: .descending), variable3.primaryKeyPart2)
43-
// ]
44-
// }
45-
46-
// Virtual table binding for FTS and so on. It is optional.
47-
// static var virtualTableBinding: VirtualTableBinding? {
48-
// return VirtualTableBinding(with: .fts3, and: ModuleArgument(with: .WCDB))
49-
// }
22+
static let objectRelationalMapping = TableBinding(CodingKeys.self) {
23+
// Column constraints for primary key, unique, not null, default value and so on. It is optional.
24+
// BindColumnConstraint(.variable1, isPrimary: true, isAutoIncrement: true)
25+
// BindColumnConstraint(.variable2, isUnique: true)
26+
27+
// Index bindings. It is optional.
28+
// BindIndex(.variable2, namedWith: "_index")
29+
30+
// Table constraints for multi-primary, multi-unique and so on. It is optional.
31+
// BindMultiPrimary(.variable2, .variable3)
32+
33+
// Virtual table binding for FTS and so on. It is optional.
34+
// BindVirtualTable(withModule: .FTS5, and: BuiltinTokenizer.Verbatim)
35+
}
5036
}
5137

5238
// Properties below are needed when the primary key is auto-increment.

0 commit comments

Comments
 (0)