例えばプロパティvar weapon: Weapon?
をdecodeしよう場合、decodeIfPresent
は便利です。書き方は下記です:
weapon = try container.decodeIfPresent(Weapon.self, forKey: .weapon)
関連記事:
例えばプロパティvar weapon: Weapon?
をdecodeしよう場合、decodeIfPresent
は便利です。書き方は下記です:
weapon = try container.decodeIfPresent(Weapon.self, forKey: .weapon)
関連記事: