Trying to use the code block below, but don't know how to get the options bit to work in the else clause, I keep getting 'NSPropertyListMutabilityOptions' is not convertible to 'NSPropertyListReadOptions'. But the Read options don't have MutableContainersWithLeaves that I need.
//if the file does not already exist
if(appStatsData != nil) {
appStats.setObject(NSNumber.numberWithInt(0), forKey:"RunCount")
appStats.setObject("No Courses Viewed", forKey:"LastCourseViewed")
}else {
appStats = NSPropertyListSerialization.propertyListWithData(appStatsData, options: NSPropertyListMutabilityOptions.MutableContainersAndLeaves, format: nil, error: &error)
}
The options
parameter has the type NSPropertyListReadOptions
which is a type alias
for Int
.
NSPropertyListMutabilityOptions
is a RawOptionSetType
with Uint
as the underlying
raw type.
Therefore you have to convert the option to an Int
with
appStats = NSPropertyListSerialization.propertyListWithData(appStatsData,
options:Int(NSPropertyListMutabilityOptions.MutableContainersAndLeaves.rawValue),
format: nil, error: &error)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With