Skip to content

Instantly share code, notes, and snippets.

@tgunr
Last active November 30, 2016 21:12
Show Gist options
  • Save tgunr/d34344a5f9972674715324d28cd4d0da to your computer and use it in GitHub Desktop.
Save tgunr/d34344a5f9972674715324d28cd4d0da to your computer and use it in GitHub Desktop.
Fail to parse if saveUserDefaults is not commented out
class IncidentList: NSObject, NSCoding {
var incidents: [Incident]
static let sharedInstance = IncidentList()
var stagedIncident: Incident?
let ArchiveURL = DocumentsDirectory.appendingPathComponent("incidents").standardizedFileURL.path
// private override init() {
// }
public override init() {
incidents = []
super.init()
}
func encode(with aCoder: NSCoder) {
aCoder.encode(incidents, forKey: PropertyKey.incidentsKey)
}
public required init?(coder aDecoder: NSCoder) {
incidents = (aDecoder.decodeObject(forKey: PropertyKey.incidentsKey) as! [Incident])
}
class func saveUserDefaults() {
let result = NSKeyedArchiver.archiveRootObject(incidents, toFile: IncidentList.sharedInstance.ArchiveURL)
if !result {
print("Failed to save gIncidents...")
}
}
1. While emitting IR SIL function @_TZFC14NoisyNeighbors12IncidentList16saveUserDefaultsfT_T_ for 'saveUserDefaults'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment