I have stuct x with an optional enum y:String, Codable. I do: var a = x() then a.myEnum = y.myEnumValue In debugger it will properly show a.myEnum to be y.myEnumValue But as soon as I do var b = [a] In debugger, the array shows correct values for any int or string I may have set but for the enum it shows nil. To make this more interesting when I examine b[0].myEnum in console I get the correct value: y.myEnumValue. Wondering if it is just an Xcode issue... link below is a screent shot of xcode (original link left off the actual issue. Below is the code fragment
import UIKit
enum x: String, Codable {
case myEnumValue
}
struct y {
var z: x?
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var a = y()
a.z = x.myEnumValue
print((a.z)!)
var j = [a]
print((j[0].z)!)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}