Fix broken example project

This commit is contained in:
Pedro Piñera Buendía 2016-03-30 12:06:26 +02:00
parent 11e414d350
commit 10632214ec
4 changed files with 28 additions and 51 deletions

View File

@ -1,42 +1,19 @@
PODS:
- ReactiveCocoa (4.0.0-RC.1):
- ReactiveCocoa/UI (= 4.0.0-RC.1)
- Result (~> 1.0)
- ReactiveCocoa/Core (4.0.0-RC.1):
- ReactiveCocoa/no-arc
- Result (~> 1.0)
- ReactiveCocoa/no-arc (4.0.0-RC.1):
- Result (~> 1.0)
- ReactiveCocoa/UI (4.0.0-RC.1):
- ReactiveCocoa/Core
- Result (~> 1.0)
- Realm (0.97.0):
- Realm/Headers (= 0.97.0)
- Realm/Headers (0.97.0)
- RealmSwift (0.97.0):
- Realm (= 0.97.0)
- Result (1.0.1)
- RxBlocking (2.0.0):
- RxSwift (~> 2.0)
- RxCocoa (2.0.0):
- RxSwift (~> 2.0)
- RxSwift (2.0.0)
- Realm (0.98.6):
- Realm/Headers (= 0.98.6)
- Realm/Headers (0.98.6)
- RealmSwift (0.98.6):
- Realm (= 0.98.6)
- Result (1.0.2)
- SnapKit (0.18.0)
- SugarRecord (2.1.5):
- SugarRecord/CoreData (= 2.1.5)
- SugarRecord/Foundation (= 2.1.5)
- SugarRecord/Realm (= 2.1.5)
- SugarRecord/CoreData (2.1.5):
- SugarRecord/Foundation
- SugarRecord/Foundation (2.1.5):
- ReactiveCocoa (= 4.0.0-RC.1)
- SugarRecord (2.2.3):
- SugarRecord/CoreData (= 2.2.3)
- SugarRecord/Realm (= 2.2.3)
- SugarRecord/CoreData (2.2.3):
- Result (~> 1.0)
- SugarRecord/Realm (2.2.3):
- RealmSwift (~> 0.98)
- Result (~> 1.0)
- RxBlocking (~> 2.0.0)
- RxCocoa (~> 2.0.0)
- RxSwift (~> 2.0.0)
- SugarRecord/Realm (2.1.5):
- RealmSwift (~> 0.97)
- SugarRecord/Foundation
DEPENDENCIES:
- SnapKit
@ -47,14 +24,10 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
ReactiveCocoa: 2b0f654beb7642b82cfd3fdb845205ae9889422c
Realm: b498a6fb9d288b171ff98d0e2d4384c295be8990
RealmSwift: d014810dec75c9a3f1a33926d2dabfed855c582c
Result: caef80340451e1f07492fa1e89117f83613bce24
RxBlocking: a95a10ed54eb5d116f6c9a87047ff671e181d07b
RxCocoa: b0ebd70b4f7450bdb3c8987b122f8fd568dc1e2f
RxSwift: d83246efa6f16c50c143bec134649d045498f601
Realm: 44803f35418c5d89b27825a564247fcd190de37e
RealmSwift: c7239c52c83f8c43525a5269ba7be1694da33afc
Result: dd3dd71af3fa2e262f1a999e14fba2c25ec14f16
SnapKit: e1f090a6d47b1dd4bd89b73f72b6746a7835ef3c
SugarRecord: 2194056941f398858fd1864b71dd4d78bc8cac6e
SugarRecord: c15bf95f637838389c4774d8fb560ce72b789f6b
COCOAPODS: 0.39.0

View File

@ -62,7 +62,7 @@ class CoreDataBasicView: UIViewController, UITableViewDelegate, UITableViewDataS
}
private func setupNavigationItem() {
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "userDidSelectAdd:")
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: #selector(CoreDataBasicView.userDidSelectAdd(_:)))
}
private func setupTableView() {
@ -95,7 +95,7 @@ class CoreDataBasicView: UIViewController, UITableViewDelegate, UITableViewDataS
db.operation({ (context, save) -> Void in
guard let obj = try! context.request(BasicObject.self).filteredWith("name", equalTo: name).fetch().first else { return }
_ = try? context.remove(obj)
save()
_ = try? save()
})
updateData()
}
@ -110,7 +110,7 @@ class CoreDataBasicView: UIViewController, UITableViewDelegate, UITableViewDataS
_object.date = NSDate()
_object.name = randomStringWithLength(10) as String
try! context.insert(_object)
save()
_ = try? save()
}
updateData()
}

View File

@ -61,7 +61,7 @@ class RealmBasicView: UIViewController, UITableViewDelegate, UITableViewDataSour
}
private func setupNavigationItem() {
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "userDidSelectAdd:")
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: #selector(RealmBasicView.userDidSelectAdd(_:)))
}
private func setupTableView() {
@ -94,7 +94,7 @@ class RealmBasicView: UIViewController, UITableViewDelegate, UITableViewDataSour
db.operation({ (context, save) -> Void in
guard let obj = try! context.request(RealmBasicObject.self).filteredWith("name", equalTo: name).fetch().first else { return }
_ = try? context.remove(obj)
save()
_ = try? save()
})
updateData()
}
@ -109,7 +109,7 @@ class RealmBasicView: UIViewController, UITableViewDelegate, UITableViewDataSour
_object.date = NSDate()
_object.name = randomStringWithLength(10) as String
try! context.insert(_object)
save()
_ = try? save()
}
updateData()
}
@ -125,6 +125,10 @@ class RealmBasicView: UIViewController, UITableViewDelegate, UITableViewDataSour
class RealmBasicObject: Object {
dynamic var date: NSDate = NSDate()
dynamic var name: String = ""
internal override class func primaryKey() -> String? {
return "name"
}
}
class RealmBasicEntity {

View File

@ -4,7 +4,7 @@ import Foundation
func randomStringWithLength (len : Int) -> NSString {
let letters : NSString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
let randomString : NSMutableString = NSMutableString(capacity: len)
for (var i=0; i < len; i++){
for _ in 0 ..< len {
let length = UInt32 (letters.length)
let rand = arc4random_uniform(length)
randomString.appendFormat("%C", letters.characterAtIndex(Int(rand)))