Swift 一些取值方法

  1. [AnyHashable: Any]型
    var result: [AnyHashable: Any] = [:]
    // No implicit conversions necessary, since String and Int are subtypes
    // of Any and AnyHashable
    result["name"] = self.name
    result["abbreviation"] = self.abbreviation
    result["population"] = self.population

你可能感兴趣的:(Swift 一些取值方法)