ios – Casting to to NSObject returns clean dictionary

0
1


I am attempting to know why after I forged my class to a [String: NSObject] I am getting again nothing. The pattern code under returns ["None": None]

remaining class UTSampleClass {
    var sampleString: String = "None"
    var sampleBool: Bool = false
}

let utSampleClass = UTSampleClass()

let properties: [String: Any] = [utSampleClass.sampleString: utSampleClass].mapValues { $0.sampleString }

if let properties = properties as? [String: NSObject] {
    print("we good fam")
    print("properties (properties)")
} else {
    print("oh poop")
}

If I take away mapValues { $0.sampleString } then I get to into the else portion of the assertion.

LEAVE A REPLY

Please enter your comment!
Please enter your name here