-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user attributes null safe explicit implementation Update User object when user logs in and out Minimal working version Read values from CoreData Store the persistent container in a shared location Fix tests
- Loading branch information
1 parent
cacab44
commit 21aeb53
Showing
11 changed files
with
206 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
BeeKit/Model/BeeminderModel.xcdatamodeld/BeeminderModel.xcdatamodel/contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22522" systemVersion="23C71" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> | ||
<entity name="User" representedClassName=".User" syncable="YES"> | ||
<attribute name="deadbeat" attributeType="Boolean" usesScalarValueType="NO"/> | ||
<attribute name="defaultAlertStart" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO"/> | ||
<attribute name="defaultDeadline" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO"/> | ||
<attribute name="defaultLeadTime" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO"/> | ||
<attribute name="timezone" attributeType="String"/> | ||
<attribute name="username" attributeType="String"/> | ||
</entity> | ||
</model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import UIKit | ||
import CoreData | ||
|
||
class BeeminderPersistentContainer: NSPersistentContainer { | ||
|
||
override open class func defaultDirectoryURL() -> URL { | ||
var storeURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.beeminder.beeminder") | ||
storeURL = storeURL?.appendingPathComponent("beeminder.sqlite") | ||
return storeURL! | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Foundation | ||
import CoreData | ||
|
||
public class User: NSManagedObject { | ||
@NSManaged public var username: String | ||
@NSManaged public var deadbeat: Bool | ||
@NSManaged public var timezone: String | ||
@NSManaged public var defaultAlertStart: Int32 | ||
@NSManaged public var defaultDeadline: Int32 | ||
@NSManaged public var defaultLeadTime: Int32 | ||
|
||
public init(context: NSManagedObjectContext, | ||
username: String, | ||
deadbeat: Bool, | ||
timezone: String, | ||
defaultAlertStart: Int32, | ||
defaultDeadline: Int32, | ||
defaultLeadTime: Int32 | ||
) { | ||
let entity = NSEntityDescription.entity(forEntityName: "User", in: context)! | ||
super.init(entity: entity, insertInto: context) | ||
self.username = username | ||
self.deadbeat = deadbeat | ||
self.timezone = timezone | ||
self.defaultAlertStart = defaultAlertStart | ||
self.defaultDeadline = defaultDeadline | ||
self.defaultLeadTime = defaultLeadTime | ||
} | ||
|
||
@available(*, unavailable) | ||
public init() { | ||
fatalError() | ||
} | ||
|
||
@available(*, unavailable) | ||
public init(context: NSManagedObjectContext) { | ||
fatalError() | ||
} | ||
|
||
public override init(entity: NSEntityDescription, insertInto: NSManagedObjectContext?) { | ||
super.init(entity: entity, insertInto: insertInto) | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.