mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-05 02:29:35 +00:00
- updated to new Swift version
This commit is contained in:
1 parent
ab832a1241
commit
717c4f929b
23 files changed
+79
-79
No files matched your search
@@ -43,7 +43,7 @@ public class DataManager: NSObject {
|
||||
if notification == NSNull() {
|
||||
return
|
||||
}
|
||||
let gpsFix = NSEntityDescription.insertNewObjectForEntityForName("GPSFix", inManagedObjectContext: self.managedObjectContext!) as GPSFix
|
||||
let gpsFix = NSEntityDescription.insertNewObjectForEntityForName("GPSFix", inManagedObjectContext: self.managedObjectContext!) as! GPSFix
|
||||
gpsFix.initWithDictionary(notification.userInfo!)
|
||||
if selectedCheckIn == nil {
|
||||
abort();
|
||||
@@ -72,23 +72,23 @@ public class DataManager: NSObject {
|
||||
}
|
||||
|
||||
func newCheckIn()->CheckIn {
|
||||
return NSEntityDescription.insertNewObjectForEntityForName("CheckIn", inManagedObjectContext: self.managedObjectContext!) as CheckIn
|
||||
return NSEntityDescription.insertNewObjectForEntityForName("CheckIn", inManagedObjectContext: self.managedObjectContext!) as! CheckIn
|
||||
}
|
||||
|
||||
func newEvent(checkIn: CheckIn) -> Event {
|
||||
var event = NSEntityDescription.insertNewObjectForEntityForName("Event", inManagedObjectContext: self.managedObjectContext!) as Event
|
||||
var event = NSEntityDescription.insertNewObjectForEntityForName("Event", inManagedObjectContext: self.managedObjectContext!) as! Event
|
||||
event.checkIn = checkIn
|
||||
return event
|
||||
}
|
||||
|
||||
func newLeaderBoard(checkIn: CheckIn) -> LeaderBoard {
|
||||
var leaderBoard = NSEntityDescription.insertNewObjectForEntityForName("LeaderBoard", inManagedObjectContext: self.managedObjectContext!) as LeaderBoard
|
||||
var leaderBoard = NSEntityDescription.insertNewObjectForEntityForName("LeaderBoard", inManagedObjectContext: self.managedObjectContext!) as! LeaderBoard
|
||||
leaderBoard.checkIn = checkIn
|
||||
return leaderBoard
|
||||
}
|
||||
|
||||
func newCompetitor(checkIn: CheckIn) -> Competitor {
|
||||
var competitor = NSEntityDescription.insertNewObjectForEntityForName("Competitor", inManagedObjectContext: self.managedObjectContext!) as Competitor
|
||||
var competitor = NSEntityDescription.insertNewObjectForEntityForName("Competitor", inManagedObjectContext: self.managedObjectContext!) as! Competitor
|
||||
competitor.checkIn = checkIn
|
||||
return competitor
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class DataManager: NSObject {
|
||||
fetchRequest.fetchLimit = APIManager.Constants.maxSendGPSFix
|
||||
var error: NSError? = nil
|
||||
let results = self.managedObjectContext!.executeFetchRequest(fetchRequest, error: &error)
|
||||
return results as [GPSFix]
|
||||
return results as! [GPSFix]
|
||||
}
|
||||
|
||||
func countCachedFixes() -> Int {
|
||||
@@ -132,7 +132,7 @@ public class DataManager: NSObject {
|
||||
lazy var applicationDocumentsDirectory: NSURL = {
|
||||
// The directory the application uses to store the Core Data store file. This code uses a directory named "com.sap.sailing.ios.CoreData" in the application's documents Application Support directory.
|
||||
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
|
||||
return urls[urls.count-1] as NSURL
|
||||
return urls[urls.count-1] as! NSURL
|
||||
}()
|
||||
|
||||
lazy var managedObjectModel: NSManagedObjectModel = {
|
||||
@@ -173,7 +173,7 @@ public class DataManager: NSObject {
|
||||
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
|
||||
dict[NSLocalizedFailureReasonErrorKey] = failureReason
|
||||
dict[NSUnderlyingErrorKey] = error
|
||||
error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
|
||||
error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict as [NSObject : AnyObject])
|
||||
// Replace this with code to handle the error appropriately.
|
||||
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
|
||||
NSLog("Unresolved error \(error), \(error!.userInfo)")
|
||||
|
||||
Reference in new issue
Block a user