Any way to construct a struct with a default value?
eminarcissus opened this issue · 0 comments
eminarcissus commented
I'm trying to poking around the process of initialization of struct, looks like it does defined everything in Runtime/Factory/DefaultValue.swift, where it use a default construction value to create the instance.
struct TestStruct
{
var id : String
var name : String
var key_type : Int = 0
var min_value : Int?
var max_value : Int?
var choice_value : String?
var meta : String?
var is_using : Bool?
var activated : Bool = true
}
for activated property, no matter if I define it true or false, it will always stay as false, is there anyway I can get the default value I defined in the code? Maybe with some help of Mirror might help here?