Thank you for your answer!
Post
Replies
Boosts
Views
Activity
Sorry, I saw your message just today.
Yes, of course, this is the code.
// MARK: - Saving Data to Archive File
// 1. Make a path to save and upload data.
static let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
static let archiveUrl = documentsDirectory.appendingPathComponent("classes").appendingPathExtension("plist")
// 2. Encoding and saving data.
static func saveToFile(classes: [ClassUnit]) {
let propertyListEncoder = PropertyListEncoder()
let encodeClasses = try? propertyListEncoder.encode(classes)
try? encodeClasses?.write(to: archiveUrl, options: .noFileProtection)
}
// 3. Deconding and load data.
static func loadFromFile() -> [ClassUnit] {
let propertyListDecoder = PropertyListDecoder()
var classes = [ClassUnit]()
if let retrivedClassesData = try? Data(contentsOf: archiveUrl), let decodeClasses = try? propertyListDecoder.decode(Array<ClassUnit>.self, from: retrivedClassesData) {
classes = decodeClasses
}
return classes
}
You can see more about this method in Apple's textbook called App Development with Swift. It can be found in iBookStore.
The fact is that in this line of code - label1.text = nil or label2.text = nil - you do not remove the attributedText, so the strikethroughStyle remains.
Thanks guys!I understand that my last questions are not for you. The main thing is that I got an answer to my most important question - is this normal or is it a hacker program? If other users also have this message and install these additional components, then everything is fine and it can be continue to work.
Thank! It has already reassured me!
Not every time, but sometimes. I have installed only one version of Xcode.I think it appears after force quit from Xcode. For some reason it sometimes freezes and doesn't work.