0
func setColor(col: UIColor) {
    let colDict: Dictionary<Int, UIColor> = [1: col]
    defaults.set(colDict, forKey: "color")
    if let dict = defaults.dictionary(forKey: "color") as? NSDictionary {
        let color = dict[1]
        view.backgroundColor = color as? UIColor
    }
}

this is my error: Thread 1: "Attempt to insert non-property list object {\n 1 = "UIExtendedSRGBColorSpace 1 0 0 1";\n} for key color"

I have tried using JSONEncoders and Arrays but it gets the same error

0 Answers0