diff --git a/Source/Sync/NSManagedObject+Sync.swift b/Source/Sync/NSManagedObject+Sync.swift index 9a956961..4d8c7edc 100644 --- a/Source/Sync/NSManagedObject+Sync.swift +++ b/Source/Sync/NSManagedObject+Sync.swift @@ -14,7 +14,7 @@ extension NSManagedObject { func sync_copyInContext(_ context: NSManagedObjectContext) -> NSManagedObject { guard let entityName = self.entity.name else { fatalError("Couldn't find entity name") } let localPrimaryKey = value(forKey: self.entity.sync_localPrimaryKey()) - guard let copiedObject = context.safeObject(entityName, localPrimaryKey: localPrimaryKey, parent: nil, parentRelationshipName: nil) else { fatalError("Couldn't fetch a safe object from entityName: \(entityName) localPrimaryKey: \(localPrimaryKey)") } + guard let copiedObject = context.safeObject(entityName, localPrimaryKey: localPrimaryKey, parent: nil, parentRelationshipName: nil) else { fatalError("Couldn't fetch a safe object from entityName: \(entityName) localPrimaryKey: \(String(describing: localPrimaryKey))") } return copiedObject } diff --git a/Source/Sync/NSManagedObjectContext+Sync.swift b/Source/Sync/NSManagedObjectContext+Sync.swift index 93dbec8a..859f1cd6 100644 --- a/Source/Sync/NSManagedObjectContext+Sync.swift +++ b/Source/Sync/NSManagedObjectContext+Sync.swift @@ -20,7 +20,7 @@ public extension NSManagedObjectContext { let objects = try fetch(request) result = objects.first as? NSManagedObject } catch { - fatalError("Failed to fetch request for entityName: \(entityName), predicate: \(request.predicate)") + fatalError("Failed to fetch request for entityName: \(entityName), predicate: \(String(describing: request.predicate))") } } else if let parentRelationshipName = parentRelationshipName { // More info: https://github.com/SyncDB/Sync/pull/72 diff --git a/Tests/DateParser/DateTests.swift b/Tests/DateParser/DateTests.swift index 751e1dd6..6c112bd7 100755 --- a/Tests/DateParser/DateTests.swift +++ b/Tests/DateParser/DateTests.swift @@ -5,7 +5,7 @@ class DateTests: XCTestCase { func testDateA() { let date = Date.dateWithHourAndTimeZoneString(dateString: "2015-06-23T12:40:08.000") - let resultDate = NSDate(fromDateString: "2015-06-23T14:40:08.000+02:00") as! Date + let resultDate = NSDate(fromDateString: "2015-06-23T14:40:08.000+02:00")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date.timeIntervalSince1970, resultDate.timeIntervalSince1970) @@ -13,7 +13,7 @@ class DateTests: XCTestCase { func testDateB() { let date = Date.dateWithDayString(dateString: "2014-01-01") - let resultDate = NSDate(fromDateString: "2014-01-01T00:00:00+00:00") as! Date + let resultDate = NSDate(fromDateString: "2014-01-01T00:00:00+00:00")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -21,7 +21,7 @@ class DateTests: XCTestCase { func testDateC() { let date = Date.dateWithDayString(dateString: "2014-01-02") - let resultDate = NSDate(fromDateString: "2014-01-02") as! Date + let resultDate = NSDate(fromDateString: "2014-01-02")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -29,7 +29,7 @@ class DateTests: XCTestCase { func testDateD() { let date = Date.dateWithDayString(dateString: "2014-01-02") - let resultDate = NSDate(fromDateString: "2014-01-02T00:00:00.000000+00:00") as! Date + let resultDate = NSDate(fromDateString: "2014-01-02T00:00:00.000000+00:00")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -37,7 +37,7 @@ class DateTests: XCTestCase { func testDateE() { let date = Date.dateWithDayString(dateString: "2015-09-10") - let resultDate = NSDate(fromDateString: "2015-09-10T00:00:00.116+0000") as! Date + let resultDate = NSDate(fromDateString: "2015-09-10T00:00:00.116+0000")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -45,7 +45,7 @@ class DateTests: XCTestCase { func testDateF() { let date = Date.dateWithDayString(dateString: "2015-09-10") - let resultDate = NSDate(fromDateString: "2015-09-10T00:00:00.184968Z") as! Date + let resultDate = NSDate(fromDateString: "2015-09-10T00:00:00.184968Z")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -53,7 +53,7 @@ class DateTests: XCTestCase { func testDateG() { let date = Date.dateWithHourAndTimeZoneString(dateString: "2015-06-23T19:04:19.911Z") - let resultDate = NSDate(fromDateString: "2015-06-23T19:04:19.911Z") as! Date + let resultDate = NSDate(fromDateString: "2015-06-23T19:04:19.911Z")! as Date print(date.timeIntervalSince1970) print(resultDate.timeIntervalSince1970) date.prettyPrint() @@ -64,7 +64,7 @@ class DateTests: XCTestCase { func testDateH() { let date = Date.dateWithHourAndTimeZoneString(dateString: "2014-03-30T09:13:00.000Z") - let resultDate = NSDate(fromDateString: "2014-03-30T09:13:00Z") as! Date + let resultDate = NSDate(fromDateString: "2014-03-30T09:13:00Z")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) } @@ -76,21 +76,21 @@ class DateTests: XCTestCase { func testDateJ() { let date = Date.dateWithDayString(dateString: "2016-01-09") - let resultDate = NSDate(fromDateString: "2016-01-09T00:00:00.00") as! Date + let resultDate = NSDate(fromDateString: "2016-01-09T00:00:00.00")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) } func testDateK() { let date = Date.dateWithDayString(dateString: "2016-01-09") - let resultDate = NSDate(fromDateString: "2016-01-09T00:00:00") as! Date + let resultDate = NSDate(fromDateString: "2016-01-09T00:00:00")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) } func testDateL() { let date = Date.dateWithDayString(dateString: "2009-10-09") - let resultDate = NSDate(fromDateString: "2009-10-09 00:00:00") as! Date + let resultDate = NSDate(fromDateString: "2009-10-09 00:00:00")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) } @@ -100,7 +100,7 @@ class TimestampDateTests: XCTestCase { func testTimestampA() { let date = Date.dateWithDayString(dateString: "2015-09-10") - let resultDate = NSDate(fromDateString: "1441843200") as! Date + let resultDate = NSDate(fromDateString: "1441843200")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -108,7 +108,7 @@ class TimestampDateTests: XCTestCase { func testTimestampB() { let date = Date.dateWithDayString(dateString: "2015-09-10") - let resultDate = NSDate(fromDateString: "1441843200000000") as! Date + let resultDate = NSDate(fromDateString: "1441843200000000")! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -116,7 +116,7 @@ class TimestampDateTests: XCTestCase { func testTimestampC() { let date = Date.dateWithDayString(dateString: "2015-09-10") - let resultDate = NSDate(fromUnixTimestampNumber: 1441843200) as! Date + let resultDate = NSDate(fromUnixTimestampNumber: 1441843200)! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate) @@ -124,7 +124,7 @@ class TimestampDateTests: XCTestCase { func testTimestampD() { let date = Date.dateWithDayString(dateString: "2015-09-10") - let resultDate = NSDate(fromUnixTimestampNumber: NSNumber(value: 1441843200000000.0)) as! Date + let resultDate = NSDate(fromUnixTimestampNumber: NSNumber(value: 1441843200000000.0))! as Date XCTAssertNotNil(resultDate) XCTAssertEqual(date, resultDate)