Skip to content

Commit

Permalink
update swift demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ljh committed Dec 7, 2016
1 parent 061d837 commit 642e543
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ xcuserdata
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/
Podfile.lock

# Carthage
#
Expand Down
2 changes: 1 addition & 1 deletion Demo-MAC/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :osx, 10.6
target 'LKDB-Demo' do
pod 'LKDBHelper'
pod 'LKDBHelper', :path => '../'
end
2 changes: 1 addition & 1 deletion Demo-Swift/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
platform :ios,8.0
use_frameworks!
target 'Swift-Demo' do
pod 'LKDBHelper'
pod 'LKDBHelper', :path => '../'
end
41 changes: 19 additions & 22 deletions Demo-Swift/Swift-Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UITextViewDelegate {

func test() {
self.add("示例 开始 example start \n\n")
let globalHelper = LKTest.getUsingLKDBHelper()!
let globalHelper = LKTest.getUsingLKDBHelper()

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

test.address = foreign

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

//事物 transaction
globalHelper.execute { (_helper) -> Bool in

guard let helper = _helper else {
return false
}
test.name = "1"
var insertSucceed = helper.insert(toDB: test);

test.name = "2"
insertSucceed = helper.insert(toDB: test);

test.name = "1"
test.rowid = 0
insertSucceed = helper.insert(toDB: test);

if insertSucceed == false {
return false
}
else {
return true
}
let helper = _helper
test.name = "1"
var insertSucceed = helper.insert(toDB: test);

test.name = "2"
insertSucceed = helper.insert(toDB: test);

test.name = "1"
test.rowid = 0
insertSucceed = helper.insert(toDB: test);

if insertSucceed == false {
return false
}
else {
return true
}
}

self.add("同步插入 完成! Insert completed synchronization")
Expand Down
11 changes: 10 additions & 1 deletion Demo-Swift/Swift-Demo/LKTestModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@ import LKDBHelper
class LKTestForeignSuper: NSObject {
var address:NSString? = nil
var postcode:Int = 0

override var description: String {
return "address:\(address) postcode:\(postcode)";
}
}

class LKTestForeign: LKTestForeignSuper {
var addid:Int = 0
var addid:Float = 0
var testModel:LKTest? = nil

override var description: String {
let desc = super.description;
return desc + " addid:\(addid) testModel:\(testModel)";
}
}

class LKTest: NSObject {
Expand Down
4 changes: 2 additions & 2 deletions LKDBHelper.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "LKDBHelper",
"version": "2.3.5",
"version": "2.4",
"summary": "全自动的插入,查询,更新,删除, an automatic database operation thread-safe and not afraid of recursive deadlock",
"description": "全面支持 NSArray,NSDictionary, ModelClass, NSNumber, NSString, NSDate, NSData, UIColor, UIImage, CGRect, CGPoint, CGSize, NSRange, int,char,float, double, long.. 等属性的自动化操作(插入和查询)",
"homepage": "https://github.com/li6185377/LKDBHelper-SQLite-ORM",
Expand All @@ -10,7 +10,7 @@
},
"source": {
"git": "https://github.com/li6185377/LKDBHelper-SQLite-ORM.git",
"tag": "2.3.5"
"tag": "2.4"
},
"platforms": {
"ios": "4.3",
Expand Down

0 comments on commit 642e543

Please sign in to comment.