SwiftyConfiguration icon indicating copy to clipboard operation
SwiftyConfiguration copied to clipboard

keep code safe

Open jeffy-w opened this issue 6 years ago • 0 comments

this part is not safe. ps: how about use 'subscript' instead of separatedKeys

var object: AnyObject = dictionary
        
        key.separatedKeys.enumerated().forEach { idx, separatedKey in
            if let index = Int(separatedKey) {
                let array = object as! Array<AnyObject>
                object = array[index]
            } else {
                let dictionary = object as! NSDictionary
                object = dictionary[separatedKey]! as AnyObject
            }
        }

jeffy-w avatar Aug 07 '20 02:08 jeffy-w