diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/AppDelegate.swift b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/AppDelegate.swift deleted file mode 100644 index e69e29a8c..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/AppDelegate.swift +++ /dev/null @@ -1,11 +0,0 @@ -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - setupDatabase(application) - return true - } -} diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 397149f3e..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@3x.png", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png deleted file mode 100644 index c58d7e79b..000000000 Binary files a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png and /dev/null differ diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png deleted file mode 100644 index 623eedec6..000000000 Binary files a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png and /dev/null differ diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Base.lproj/LaunchScreen.storyboard b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 2e721e183..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Base.lproj/Main.storyboard b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Base.lproj/Main.storyboard deleted file mode 100644 index ac4ded116..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Base.lproj/Main.storyboard +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Database.swift b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Database.swift deleted file mode 100644 index 3dcc278f6..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Database.swift +++ /dev/null @@ -1,50 +0,0 @@ -import GRDBCipher -import UIKit - -// The shared database queue -var dbQueue: DatabaseQueue! - -func setupDatabase(application: UIApplication) { - - // Connect to the database - // See https://github.com/groue/GRDB.swift/#database-connections - - let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString - let databasePath = documentsPath.stringByAppendingPathComponent("db.sqlite") - var configuration = Configuration() - configuration.passphrase = "secret" - dbQueue = try! DatabaseQueue(path: databasePath) - - - // Be a nice iOS citizen, and don't consume too much memory - // See https://github.com/groue/GRDB.swift/#memory-management - - dbQueue.setupMemoryManagement(application: application) - - - // Use DatabaseMigrator to setup the database - // See https://github.com/groue/GRDB.swift/#migrations - - var migrator = DatabaseMigrator() - - migrator.registerMigration("createPersons") { db in - // Have person names compared in a localized case insensitive fashion - // See https://github.com/groue/GRDB.swift/#unicide - let collation = DatabaseCollation.localizedCaseInsensitiveCompare - try db.execute( - "CREATE TABLE persons (" + - "id INTEGER PRIMARY KEY, " + - "name TEXT NOT NULL COLLATE \(collation.name), " + - "score INTEGER NOT NULL " + - ")") - } - - migrator.registerMigration("addPersons") { db in - // Populate the persons table with random data - for _ in 0..<8 { - try Person(name: Person.randomName(), score: Person.randomScore()).insert(db) - } - } - - try! migrator.migrate(dbQueue) -} diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/DemoViewController.swift b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/DemoViewController.swift deleted file mode 100644 index 58f08d16a..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/DemoViewController.swift +++ /dev/null @@ -1,10 +0,0 @@ -import UIKit - -class DemoViewController: UITableViewController { - - override func viewWillAppear(animated: Bool) { - super.viewWillAppear(true) - navigationController?.toolbarHidden = true - navigationItem.backBarButtonItem = UIBarButtonItem(title: "Demo", style: .Plain, target: nil, action: nil) - } -} diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Icon.sketch b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Icon.sketch deleted file mode 100644 index f2138aaa9..000000000 Binary files a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Icon.sketch and /dev/null differ diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Info.plist b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Info.plist deleted file mode 100644 index df8bf3764..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - GRDB Demo - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - - diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Person.swift b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Person.swift deleted file mode 100644 index 63d625aec..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/Person.swift +++ /dev/null @@ -1,50 +0,0 @@ -import GRDBCipher - -class Person: Record { - var id: Int64? - var name: String - var score: Int - - init(name: String, score: Int) { - self.name = name - self.score = score - super.init() - } - - // MARK: Record overrides - - override class func databaseTableName() -> String { - return "persons" - } - - required init(_ row: Row) { - id = row.value(named: "id") - name = row.value(named: "name") - score = row.value(named: "score") - super.init(row) - } - - override var persistentDictionary: [String : DatabaseValueConvertible?] { - return [ - "id": id, - "name": name, - "score": score] - } - - override func didInsertWithRowID(rowID: Int64, forColumn column: String?) { - id = rowID - } - - // MARK: Random - - private static let names = ["Arthur", "Anita", "Barbara", "Bernard", "Craig", "Chiara", "David", "Dean", "Éric", "Elena", "Fatima", "Frederik", "Gilbert", "Georgette", "Henriette", "Hassan", "Ignacio", "Irene", "Julie", "Jack", "Karl", "Kristel", "Louis", "Liz", "Masashi", "Mary", "Noam", "Nicole", "Ophelie", "Oleg", "Pascal", "Patricia", "Quentin", "Quinn", "Raoul", "Rachel", "Stephan", "Susie", "Tristan", "Tatiana", "Ursule", "Urbain", "Victor", "Violette", "Wilfried", "Wilhelmina", "Yvon", "Yann", "Zazie", "Zoé"] - - class func randomName() -> String { - return names[Int(arc4random_uniform(UInt32(names.count)))] - } - - class func randomScore() -> Int { - return 10 * Int(arc4random_uniform(101)) - } - -} diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/PersonEditionViewController.swift b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/PersonEditionViewController.swift deleted file mode 100644 index 191a01d73..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/PersonEditionViewController.swift +++ /dev/null @@ -1,104 +0,0 @@ -import UIKit - -protocol PersonEditionViewControllerDelegate: class { - func personEditionControllerDidComplete(controller: PersonEditionViewController) -} - -class PersonEditionViewController: UITableViewController { - weak var delegate: PersonEditionViewControllerDelegate? - var person: Person! { didSet { configureView() } } - var cancelButtonHidden: Bool = false { didSet { configureView() } } - var commitButtonHidden: Bool = false { didSet { configureView() } } - - @IBOutlet private weak var cancelBarButtonItem: UIBarButtonItem! - @IBOutlet private weak var commitBarButtonItem: UIBarButtonItem! - @IBOutlet private weak var nameCell: UITableViewCell! - @IBOutlet private weak var nameTextField: UITextField! - @IBOutlet private weak var scoreCell: UITableViewCell! - @IBOutlet private weak var scoreTextField: UITextField! - - func applyChanges() { - if let name = nameTextField.text where !name.isEmpty { - person.name = name - } - person.score = scoreTextField.text.flatMap { Int($0) } ?? 0 - } - - override func viewDidLoad() { - super.viewDidLoad() - configureView() - } - - private func configureView() { - guard isViewLoaded() else { return } - - nameTextField.text = person.name - if person.score == 0 && person.id == nil { - scoreTextField.text = "" - } else { - scoreTextField.text = "\(person.score)" - } - - if cancelButtonHidden { - navigationItem.leftBarButtonItem = nil - } else { - navigationItem.leftBarButtonItem = cancelBarButtonItem - } - - if cancelButtonHidden { - navigationItem.rightBarButtonItem = nil - } else { - navigationItem.rightBarButtonItem = commitBarButtonItem - } - } -} - - -// MARK: - Navigation - -extension PersonEditionViewController { - - override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool { - // Force keyboard to dismiss early - view.endEditing(true) - return true - } - - override func willMoveToParentViewController(parent: UIViewController?) { - super.willMoveToParentViewController(parent) - - if parent == nil { - // Self is popping from its navigation controller - delegate?.personEditionControllerDidComplete(self) - } - } - -} - - -// MARK: - Form - -extension PersonEditionViewController: UITextFieldDelegate { - - override func viewWillAppear(animated: Bool) { - super.viewWillAppear(animated) - nameTextField.becomeFirstResponder() - } - - override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { - tableView.deselectRowAtIndexPath(indexPath, animated: false) - let cell = tableView.cellForRowAtIndexPath(indexPath) - if cell === nameCell { - nameTextField.becomeFirstResponder() - } else if cell === scoreCell { - scoreTextField.becomeFirstResponder() - } - } - - func textFieldShouldReturn(textField: UITextField) -> Bool { - if textField == nameTextField { - scoreTextField.becomeFirstResponder() - } - return false - } -} diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/PersonsViewController.swift b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/PersonsViewController.swift deleted file mode 100644 index 089f3128a..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/PersonsViewController.swift +++ /dev/null @@ -1,243 +0,0 @@ -import UIKit -import GRDBCipher - -class PersonsViewController: UITableViewController { - var personsController: FetchedRecordsController! - - override func viewDidLoad() { - super.viewDidLoad() - - navigationItem.rightBarButtonItems = [ - UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: .addPerson), - editButtonItem() - ] - - let request = personsSortedByScore - personsController = FetchedRecordsController(dbQueue, request: request, compareRecordsByPrimaryKey: true) - personsController.delegate = self - personsController.performFetch() - - configureToolbar() - } - - override func viewWillAppear(animated: Bool) { - super.viewWillAppear(animated) - navigationController?.toolbarHidden = false - } -} - - -// MARK: - Navigation - -extension PersonsViewController : PersonEditionViewControllerDelegate { - - override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { - if segue.identifier == "EditPerson" { - let person = personsController.recordAtIndexPath(tableView.indexPathForSelectedRow!) - let controller = segue.destinationViewController as! PersonEditionViewController - controller.title = person.name - controller.person = person - controller.delegate = self // we will save person when back button is tapped - controller.cancelButtonHidden = true - controller.commitButtonHidden = true - } - else if segue.identifier == "NewPerson" { - setEditing(false, animated: true) - let navigationController = segue.destinationViewController as! UINavigationController - let controller = navigationController.viewControllers.first as! PersonEditionViewController - controller.title = "New Person" - controller.person = Person(name: "", score: 0) - } - } - - @IBAction func addPerson(sender: AnyObject?) { - performSegueWithIdentifier("NewPerson", sender: sender) - } - - @IBAction func cancelPersonEdition(segue: UIStoryboardSegue) { - // Person creation: cancel button was tapped - } - - @IBAction func commitPersonEdition(segue: UIStoryboardSegue) { - // Person creation: commit button was tapped - let controller = segue.sourceViewController as! PersonEditionViewController - controller.applyChanges() - let person = controller.person - if !person.name.isEmpty { - try! dbQueue.inDatabase { db in - try person.save(db) - } - } - } - - func personEditionControllerDidComplete(controller: PersonEditionViewController) { - // Person edition: back button was tapped - controller.applyChanges() - let person = controller.person - if !person.name.isEmpty { - try! dbQueue.inDatabase { db in - try person.save(db) - } - } - } -} - - -// MARK: - UITableViewDataSource - -extension PersonsViewController { - func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) { - let person = personsController.recordAtIndexPath(indexPath) - cell.textLabel?.text = person.name - cell.detailTextLabel?.text = abs(person.score) > 1 ? "\(person.score) points" : "0 point" - } - - override func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return personsController.sections.count - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return personsController.sections[section].numberOfRecords - } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Person", forIndexPath: indexPath) - configureCell(cell, atIndexPath: indexPath) - return cell - } - - override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { - // Delete the person - let person = personsController.recordAtIndexPath(indexPath) - try! person.delete(dbQueue) - } -} - - -// MARK: - FetchedRecordsControllerDelegate - -extension PersonsViewController : FetchedRecordsControllerDelegate { - - func controllerWillChangeRecords(controller: FetchedRecordsController) { - tableView.beginUpdates() - } - - func controller(controller: FetchedRecordsController, didChangeRecord record: T, withEvent event:FetchedRecordsEvent) { - switch event { - case .Insertion(let indexPath): - tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) - - case .Deletion(let indexPath): - tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) - - case .Update(let indexPath, _): - if let cell = tableView.cellForRowAtIndexPath(indexPath) { - configureCell(cell, atIndexPath: indexPath) - } - - case .Move(let indexPath, let newIndexPath, _): - // Actually move cells around for more demo effect :-) - let cell = tableView.cellForRowAtIndexPath(indexPath) - tableView.moveRowAtIndexPath(indexPath, toIndexPath: newIndexPath) - if let cell = cell { - configureCell(cell, atIndexPath: newIndexPath) - } - - // A quieter animation: - // tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) - // tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade) - } - } - - func controllerDidChangeRecords(controller: FetchedRecordsController) { - tableView.endUpdates() - } -} - - -// MARK: - FetchedRecordsController Demo - -extension PersonsViewController { - - private func configureToolbar() { - toolbarItems = [ - UIBarButtonItem(title: "Name ⬆︎", style: .Plain, target: self, action: .sortByName), - UIBarButtonItem(title: "Score ⬇︎", style: .Plain, target: self, action: .sortByScore), - UIBarButtonItem(title: "Randomize", style: .Plain, target: self, action: .randomizeScores), - UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: nil, action: nil), - UIBarButtonItem(title: "💣", style: .Plain, target: self, action: .stressTest) - ] - } - - @IBAction func sortByName() { - setEditing(false, animated: true) - personsController.setRequest(personsSortedByName) - } - - @IBAction func sortByScore() { - setEditing(false, animated: true) - personsController.setRequest(personsSortedByScore) - } - - @IBAction func randomizeScores() { - setEditing(false, animated: true) - - try! dbQueue.inTransaction { db in - for person in Person.fetch(db) { - person.score = Person.randomScore() - try person.update(db) - } - return .Commit - } - } - - @IBAction func stressTest() { - setEditing(false, animated: true) - - // Spawn some concurrent background jobs - for _ in 0..<20 { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { - try! dbQueue.inTransaction { db in - if Person.fetchCount(db) == 0 { - // Insert persons - for _ in 0..<8 { - try Person(name: Person.randomName(), score: Person.randomScore()).insert(db) - } - } else { - // Insert a person - if arc4random_uniform(2) == 0 { - let person = Person(name: Person.randomName(), score: Person.randomScore()) - try person.insert(db) - } - // Delete a person - if arc4random_uniform(2) == 0 { - if let person = Person.order(sql: "RANDOM()").fetchOne(db) { - try person.delete(db) - } - } - // Update some persons - for person in Person.fetchAll(db) { - if arc4random_uniform(2) == 0 { - person.score = Person.randomScore() - try person.update(db) - } - } - } - return .Commit - } - } - } - } -} - -// https://medium.com/swift-programming/swift-selector-syntax-sugar-81c8a8b10df3 -private extension Selector { - static let addPerson = #selector(PersonsViewController.addPerson(_:)) - static let sortByName = #selector(PersonsViewController.sortByName) - static let sortByScore = #selector(PersonsViewController.sortByScore) - static let randomizeScores = #selector(PersonsViewController.randomizeScores) - static let stressTest = #selector(PersonsViewController.stressTest) -} - -private let personsSortedByName = Person.order(SQLColumn("name")) -private let personsSortedByScore = Person.order(SQLColumn("score").desc, SQLColumn("name")) diff --git a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/SimplePersonsViewController.swift b/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/SimplePersonsViewController.swift deleted file mode 100644 index 195fcff38..000000000 --- a/Tests/Carthage/GRDBCipheriOS/GRDBDemoiOS/SimplePersonsViewController.swift +++ /dev/null @@ -1,110 +0,0 @@ -import UIKit -import GRDBCipher - -class SimplePersonsViewController: UITableViewController { - var persons: [Person]! - - override func viewDidLoad() { - super.viewDidLoad() - - navigationItem.rightBarButtonItems = [ - UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: #selector(SimplePersonsViewController.addPerson(_:))), - editButtonItem() - ] - } - - override func viewWillAppear(animated: Bool) { - super.viewWillAppear(animated) - loadPersons() - tableView.reloadData() - } - - private func loadPersons() { - persons = Person.order(SQLColumn("score").desc, SQLColumn("name")).fetchAll(dbQueue) - } -} - - -// MARK: - Navigation - -extension SimplePersonsViewController : PersonEditionViewControllerDelegate { - - override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { - if segue.identifier == "EditPerson" { - let person = persons[tableView.indexPathForSelectedRow!.row] - let controller = segue.destinationViewController as! PersonEditionViewController - controller.title = person.name - controller.person = person - controller.delegate = self // we will save person when back button is tapped - controller.cancelButtonHidden = true - controller.commitButtonHidden = true - } - else if segue.identifier == "NewPerson" { - setEditing(false, animated: true) - let navigationController = segue.destinationViewController as! UINavigationController - let controller = navigationController.viewControllers.first as! PersonEditionViewController - controller.title = "New Person" - controller.person = Person(name: "", score: 0) - } - } - - @IBAction func addPerson(sender: AnyObject?) { - performSegueWithIdentifier("NewPerson", sender: sender) - } - - @IBAction func cancelPersonEdition(segue: UIStoryboardSegue) { - // Person creation: cancel button was tapped - } - - @IBAction func commitPersonEdition(segue: UIStoryboardSegue) { - // Person creation: commit button was tapped - let controller = segue.sourceViewController as! PersonEditionViewController - controller.applyChanges() - let person = controller.person - if !person.name.isEmpty { - try! dbQueue.inDatabase { db in - try person.save(db) - } - } - } - - func personEditionControllerDidComplete(controller: PersonEditionViewController) { - // Person edition: back button was tapped - controller.applyChanges() - let person = controller.person - if !person.name.isEmpty { - try! dbQueue.inDatabase { db in - try person.save(db) - } - } - } -} - - -// MARK: - UITableViewDataSource - -extension SimplePersonsViewController { - func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) { - let person = persons[indexPath.row] - cell.textLabel?.text = person.name - cell.detailTextLabel?.text = abs(person.score) > 1 ? "\(person.score) points" : "0 point" - } - - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return persons.count - } - - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("Person", forIndexPath: indexPath) - configureCell(cell, atIndexPath: indexPath) - return cell - } - - override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { - // Delete the person - let person = persons[indexPath.row] - try! person.delete(dbQueue) - persons.removeAtIndex(indexPath.row) - tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) - } -} diff --git a/Tests/Carthage/GRDBCipheriOS/iOS.xcodeproj/project.pbxproj b/Tests/Carthage/GRDBCipheriOS/iOS.xcodeproj/project.pbxproj deleted file mode 100644 index 975c2c71c..000000000 --- a/Tests/Carthage/GRDBCipheriOS/iOS.xcodeproj/project.pbxproj +++ /dev/null @@ -1,368 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 5644E4041C1072A30090716E /* GRDBCipher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5644E4031C1072A30090716E /* GRDBCipher.framework */; }; - 5644E4061C1072CA0090716E /* GRDBCipher.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5644E4031C1072A30090716E /* GRDBCipher.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 567374431B4D46600089DE44 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374411B4D46600089DE44 /* Main.storyboard */; }; - 567374451B4D46600089DE44 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 567374441B4D46600089DE44 /* Assets.xcassets */; }; - 567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374461B4D46600089DE44 /* LaunchScreen.storyboard */; }; - 568E2B991CACE4ED00426E7B /* SimplePersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568E2B981CACE4ED00426E7B /* SimplePersonsViewController.swift */; }; - 56AEC9D91CAA985700452D96 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D21CAA985700452D96 /* AppDelegate.swift */; }; - 56AEC9DA1CAA985700452D96 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D31CAA985700452D96 /* Database.swift */; }; - 56AEC9DB1CAA985700452D96 /* DemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D41CAA985700452D96 /* DemoViewController.swift */; }; - 56AEC9DD1CAA985700452D96 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D61CAA985700452D96 /* Person.swift */; }; - 56AEC9DE1CAA985700452D96 /* PersonEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D71CAA985700452D96 /* PersonEditionViewController.swift */; }; - 56AEC9DF1CAA985700452D96 /* PersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D81CAA985700452D96 /* PersonsViewController.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 5644E4071C1072CA0090716E /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 5644E4061C1072CA0090716E /* GRDBCipher.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 5644E4031C1072A30090716E /* GRDBCipher.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GRDBCipher.framework; path = ../../../Carthage/Build/iOS/GRDBCipher.framework; sourceTree = ""; }; - 567374381B4D46600089DE44 /* iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 567374421B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 567374441B4D46600089DE44 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 567374471B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 567374491B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 568E2B981CACE4ED00426E7B /* SimplePersonsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimplePersonsViewController.swift; sourceTree = ""; }; - 56AEC9D21CAA985700452D96 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 56AEC9D31CAA985700452D96 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = ""; }; - 56AEC9D41CAA985700452D96 /* DemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoViewController.swift; sourceTree = ""; }; - 56AEC9D61CAA985700452D96 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = ""; }; - 56AEC9D71CAA985700452D96 /* PersonEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonEditionViewController.swift; sourceTree = ""; }; - 56AEC9D81CAA985700452D96 /* PersonsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonsViewController.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 567374351B4D46600089DE44 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5644E4041C1072A30090716E /* GRDBCipher.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 5673742F1B4D46600089DE44 = { - isa = PBXGroup; - children = ( - 5644E4031C1072A30090716E /* GRDBCipher.framework */, - 5673743A1B4D46600089DE44 /* GRDBDemoiOS */, - 567374391B4D46600089DE44 /* Products */, - ); - sourceTree = ""; - }; - 567374391B4D46600089DE44 /* Products */ = { - isa = PBXGroup; - children = ( - 567374381B4D46600089DE44 /* iOS.app */, - ); - name = Products; - sourceTree = ""; - }; - 5673743A1B4D46600089DE44 /* GRDBDemoiOS */ = { - isa = PBXGroup; - children = ( - 56AEC9D21CAA985700452D96 /* AppDelegate.swift */, - 567374441B4D46600089DE44 /* Assets.xcassets */, - 56AEC9D31CAA985700452D96 /* Database.swift */, - 56AEC9D41CAA985700452D96 /* DemoViewController.swift */, - 567374491B4D46600089DE44 /* Info.plist */, - 567374461B4D46600089DE44 /* LaunchScreen.storyboard */, - 567374411B4D46600089DE44 /* Main.storyboard */, - 56AEC9D61CAA985700452D96 /* Person.swift */, - 56AEC9D71CAA985700452D96 /* PersonEditionViewController.swift */, - 56AEC9D81CAA985700452D96 /* PersonsViewController.swift */, - 568E2B981CACE4ED00426E7B /* SimplePersonsViewController.swift */, - ); - path = GRDBDemoiOS; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 567374371B4D46600089DE44 /* iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 567374621B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOS" */; - buildPhases = ( - 567374341B4D46600089DE44 /* Sources */, - 567374351B4D46600089DE44 /* Frameworks */, - 567374361B4D46600089DE44 /* Resources */, - 567374741B4D7A3B0089DE44 /* ShellScript */, - 5644E4071C1072CA0090716E /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = iOS; - productName = iOS; - productReference = 567374381B4D46600089DE44 /* iOS.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 567374301B4D46600089DE44 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0700; - ORGANIZATIONNAME = "Gwendal Roué"; - TargetAttributes = { - 567374371B4D46600089DE44 = { - CreatedOnToolsVersion = 7.0; - DevelopmentTeam = AMD8W895CT; - }; - }; - }; - buildConfigurationList = 567374331B4D46600089DE44 /* Build configuration list for PBXProject "iOS" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 5673742F1B4D46600089DE44; - productRefGroup = 567374391B4D46600089DE44 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 567374371B4D46600089DE44 /* iOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 567374361B4D46600089DE44 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */, - 567374451B4D46600089DE44 /* Assets.xcassets in Resources */, - 567374431B4D46600089DE44 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 567374741B4D7A3B0089DE44 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/../../../Carthage/Build/iOS/GRDB.framework", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/local/bin/carthage copy-frameworks"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 567374341B4D46600089DE44 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 56AEC9DD1CAA985700452D96 /* Person.swift in Sources */, - 56AEC9DF1CAA985700452D96 /* PersonsViewController.swift in Sources */, - 56AEC9DB1CAA985700452D96 /* DemoViewController.swift in Sources */, - 56AEC9DA1CAA985700452D96 /* Database.swift in Sources */, - 568E2B991CACE4ED00426E7B /* SimplePersonsViewController.swift in Sources */, - 56AEC9DE1CAA985700452D96 /* PersonEditionViewController.swift in Sources */, - 56AEC9D91CAA985700452D96 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 567374411B4D46600089DE44 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 567374421B4D46600089DE44 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 567374461B4D46600089DE44 /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 567374471B4D46600089DE44 /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 567374601B4D46600089DE44 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 567374611B4D46600089DE44 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 567374631B4D46600089DE44 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../../../Carthage/Build/iOS", - ); - INFOPLIST_FILE = ../../../DemoApps/GRDBDemoiOS/GRDBDemoiOS/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = GRDB.CarthageTest; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 567374641B4D46600089DE44 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../../../Carthage/Build/iOS", - ); - INFOPLIST_FILE = ../../../DemoApps/GRDBDemoiOS/GRDBDemoiOS/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = GRDB.CarthageTest; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 567374331B4D46600089DE44 /* Build configuration list for PBXProject "iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 567374601B4D46600089DE44 /* Debug */, - 567374611B4D46600089DE44 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 567374621B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 567374631B4D46600089DE44 /* Debug */, - 567374641B4D46600089DE44 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 567374301B4D46600089DE44 /* Project object */; -} diff --git a/Tests/Carthage/GRDBCipheriOS/iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Tests/Carthage/GRDBCipheriOS/iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 92a930669..000000000 --- a/Tests/Carthage/GRDBCipheriOS/iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - -