Use UInt only when you specifically need an unsigned integer type with the same size as the platform\u2019s native word size. If this is not the case, Int is preferred, even when the values to be stored are known to be non-negative. A consistent use of Int for integer values aids code interoperability, avoids the need to convert between different number types, and matches integer type inference, as described in Type Safety and Type Inference.<\/p><\/blockquote>\n
\u3053\u308c\u306b\u3088\u308b\u3068\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30ef\u30fc\u30c9\u30b5\u30a4\u30ba\u3068\u540c\u3058\u5927\u304d\u3055\u306e\u7b26\u53f7\u306a\u3057\u6574\u6570\u578b\u304c\u5fc5\u8981\u306a\u6642\u306e\u307f UInt \u3092\u4f7f\u3046\u3079\u304d<\/strong>\u3067, \u305f\u3068\u3048\u683c\u7d0d\u3055\u308c\u308b\u5024\u304c\u975e\u8ca0\u3067\u3042\u308b\u3053\u3068\u304c\u81ea\u660e\u306a\u5834\u5408\u3067\u3082 Int \u3092\u4f7f\u3046\u3088\u3046\u306b\u3057\u305f\u307b\u3046\u304c\u597d\u307e\u3057\u3044<\/strong>\u3068\u306e\u3053\u3068\u3067\u3059.<\/p>\nInt \u3092\u4f7f\u3046\u3079\u304d\u7406\u7531\u3068\u3057\u3066\u306f, \u30b3\u30fc\u30c9\u306e\u76f8\u4e92\u904b\u7528\u6027\u3092\u52a9\u3051, \u7570\u306a\u308b\u6570\u5024\u578b\u306e\u9593\u3092\u5909\u63db\u3059\u308b\u5fc5\u8981\u3092\u907f\u3051\u308b\u3053\u3068\u306a\u3069\u304c\u6319\u3052\u3089\u308c\u3066\u3044\u307e\u3059.<\/p>\n
Swift \u3067\u306f Objective-C \u3068\u306f\u7570\u306a\u308a, Int <-> UInt \u306e\u9593\u3067\u306e\u578b\u5909\u63db\u306f\u660e\u793a\u7684\u306b\u8a18\u8ff0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081, Apple \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u3042\u308b\u3088\u3046\u306b\u901a\u5e38\u306f Int \u3092\u7528\u3044\u308b\u3088\u3046\u306b\u3057\u305f\u307b\u3046\u304c\u4e0d\u8981\u306a\u578b\u5909\u63db\u3092\u66f8\u304b\u305a\u306b\u6e08\u3080\u305f\u3081\u826f\u3055\u305d\u3046\u3067\u3059.<\/p>\n","protected":false},"excerpt":{"rendered":"
Swift \u3067\u306f\u975e\u8ca0\u6574\u6570\u3067\u3042\u308b\u3053\u3068\u304c\u81ea\u660e\u306a\u5834\u5408\u3067\u3082, \u7279\u5225\u306a\u7406\u7531\u304c\u306a\u3044\u5834\u5408 UInt \u3088\u308a Int \u3092\u7528\u3044\u308b\u306e\u304c\u826f\u3044\u3088\u3046\u3067\u3059.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[60],"_links":{"self":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/609"}],"collection":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/comments?post=609"}],"version-history":[{"count":4,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/609\/revisions"}],"predecessor-version":[{"id":613,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/609\/revisions\/613"}],"wp:attachment":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media?parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/categories?post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/tags?post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}