Skip to content

Commit 642e543

Browse files
author
ljh
committed
update swift demo
1 parent 061d837 commit 642e543

File tree

6 files changed

+34
-27
lines changed

6 files changed

+34
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ xcuserdata
3535
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
3636
#
3737
Pods/
38+
Podfile.lock
3839

3940
# Carthage
4041
#

Demo-MAC/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
platform :osx, 10.6
22
target 'LKDB-Demo' do
3-
pod 'LKDBHelper'
3+
pod 'LKDBHelper', :path => '../'
44
end

Demo-Swift/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
platform :ios,8.0
22
use_frameworks!
33
target 'Swift-Demo' do
4-
pod 'LKDBHelper'
4+
pod 'LKDBHelper', :path => '../'
55
end

Demo-Swift/Swift-Demo/AppDelegate.swift

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UITextViewDelegate {
4949

5050
func test() {
5151
self.add("示例 开始 example start \n\n")
52-
let globalHelper = LKTest.getUsingLKDBHelper()!
52+
let globalHelper = LKTest.getUsingLKDBHelper()
5353

5454
///删除所有表 delete all table
5555
globalHelper.dropAllTable()
@@ -68,7 +68,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UITextViewDelegate {
6868
let foreign = LKTestForeign.init()
6969
foreign.address = ":asdasdasdsadasdsdas"
7070
foreign.postcode = 123341
71-
foreign.addid = 213214
71+
foreign.addid = 213.12312
7272

7373
test.address = foreign
7474

@@ -89,26 +89,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UITextViewDelegate {
8989

9090
//事物 transaction
9191
globalHelper.execute { (_helper) -> Bool in
92-
93-
guard let helper = _helper else {
94-
return false
95-
}
96-
test.name = "1"
97-
var insertSucceed = helper.insert(toDB: test);
98-
99-
test.name = "2"
100-
insertSucceed = helper.insert(toDB: test);
101-
102-
test.name = "1"
103-
test.rowid = 0
104-
insertSucceed = helper.insert(toDB: test);
105-
106-
if insertSucceed == false {
107-
return false
108-
}
109-
else {
110-
return true
111-
}
92+
let helper = _helper
93+
test.name = "1"
94+
var insertSucceed = helper.insert(toDB: test);
95+
96+
test.name = "2"
97+
insertSucceed = helper.insert(toDB: test);
98+
99+
test.name = "1"
100+
test.rowid = 0
101+
insertSucceed = helper.insert(toDB: test);
102+
103+
if insertSucceed == false {
104+
return false
105+
}
106+
else {
107+
return true
108+
}
112109
}
113110

114111
self.add("同步插入 完成! Insert completed synchronization")

Demo-Swift/Swift-Demo/LKTestModels.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,20 @@ import LKDBHelper
1212
class LKTestForeignSuper: NSObject {
1313
var address:NSString? = nil
1414
var postcode:Int = 0
15+
16+
override var description: String {
17+
return "address:\(address) postcode:\(postcode)";
18+
}
1519
}
1620

1721
class LKTestForeign: LKTestForeignSuper {
18-
var addid:Int = 0
22+
var addid:Float = 0
1923
var testModel:LKTest? = nil
24+
25+
override var description: String {
26+
let desc = super.description;
27+
return desc + " addid:\(addid) testModel:\(testModel)";
28+
}
2029
}
2130

2231
class LKTest: NSObject {

LKDBHelper.podspec.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "LKDBHelper",
3-
"version": "2.3.5",
3+
"version": "2.4",
44
"summary": "全自动的插入,查询,更新,删除, an automatic database operation thread-safe and not afraid of recursive deadlock",
55
"description": "全面支持 NSArray,NSDictionary, ModelClass, NSNumber, NSString, NSDate, NSData, UIColor, UIImage, CGRect, CGPoint, CGSize, NSRange, int,char,float, double, long.. 等属性的自动化操作(插入和查询)",
66
"homepage": "https://github.com/li6185377/LKDBHelper-SQLite-ORM",
@@ -10,7 +10,7 @@
1010
},
1111
"source": {
1212
"git": "https://github.com/li6185377/LKDBHelper-SQLite-ORM.git",
13-
"tag": "2.3.5"
13+
"tag": "2.4"
1414
},
1515
"platforms": {
1616
"ios": "4.3",

0 commit comments

Comments
 (0)