{"id":130839,"date":"2025-09-18T11:42:49","date_gmt":"2025-09-18T02:42:49","guid":{"rendered":"https:\/\/softantenna.com\/blog\/?p=130839"},"modified":"2025-09-18T11:42:49","modified_gmt":"2025-09-18T02:42:49","slug":"swift-6-2","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/swift-6-2\/","title":{"rendered":"Swift 6.2\u304c\u767b\u5834\uff01\u958b\u767a\u8005\u306e\u751f\u7523\u6027\u3092\u9ad8\u3081\u308b\u65b0\u6a5f\u80fd\u6e80\u8f09"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2025\/09\/swift62.jpg\" alt=\"\" width=\"1280\" height=\"556\" class=\"aligncenter size-full wp-image-130840\" \/><\/p>\n<p>Apple\u306f9\u670815\u65e5(\u73fe\u5730\u6642\u9593)\u3001Swift 6.2\u3092\u6b63\u5f0f\u306b\u30ea\u30ea\u30fc\u30b9\u3057\u307e\u3057\u305f(<a href=\"https:\/\/www.swift.org\/blog\/swift-6.2-released\/#safe-systems-programming\">\u516c\u5f0f\u30d6\u30ed\u30b0<\/a>)\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306f\u3001\u3059\u3079\u3066\u306eSwift\u958b\u767a\u8005\u306e\u751f\u7523\u6027\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u3092\u76ee\u7684\u3068\u3057\u305f\u3082\u306e\u3067\u3001\u8a00\u8a9e\u4ed5\u69d8\u304b\u3089\u30c4\u30fc\u30eb\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u3001\u30c7\u30d0\u30c3\u30b0\u6a5f\u80fd\u307e\u3067\u5e45\u5e83\u304f\u5f37\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u3088\u308a\u81ea\u7136\u306a\u4e26\u884c\u51e6\u7406\uff08Concurrency\uff09\u306e\u5b9f\u73fe<\/h2>\n<p>\u3088\u308a\u81ea\u7136\u3067\u5b89\u5168\u306a\u4e26\u884c\u51e6\u7406(Concurrency)\u306e\u5b9f\u73fe\u306e\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5909\u66f4\u304c\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n<p><span><strong>\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3067\u306e\u5b9f\u884c\u304c\u7c21\u5358\u306b<\/strong>\uff1a<code>@MainActor<\/code>\u306e\u660e\u793a\u306a\u3057\u3067\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306b\u30b3\u30fc\u30c9\u3092\u9694\u96e2\u53ef\u80fd\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span><strong>\u76f4\u611f\u7684\u306aasync\u95a2\u6570<\/strong>\uff1a\u975e\u540c\u671f\u95a2\u6570\u304c\u547c\u3073\u51fa\u3057\u5143\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3067\u5b9f\u884c\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u3001\u30c7\u30fc\u30bf\u7af6\u5408\u306e\u5fc3\u914d\u304c\u6e1b\u5c11\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span><strong>@concurrent\u5c5e\u6027\u306e\u5c0e\u5165<\/strong>\uff1a\u4e26\u884c\u51e6\u7406\u3092\u660e\u793a\u7684\u306b\u6307\u5b9a\u3067\u304d\u3001\u30b3\u30fc\u30c9\u306e\u610f\u56f3\u304c\u3088\u308a\u660e\u78ba\u306b\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<pre>\/\/ In '-default-isolation MainActor' mode\r\n\r\nstruct Image {\r\n  \/\/ The image cache is safe because it's protected\r\n  \/\/ by the main actor.\r\n  static var cachedImage: [URL: Image] = [:]\r\n\r\n  static func create(from url: URL) async throws -> Image {\r\n    if let image = cachedImage[url] {\r\n      return image\r\n    }\r\n\r\n    let image = try await fetchImage(at: url)\r\n\r\n    cachedImage[url] = image\r\n    return image\r\n  }\r\n\r\n  \/\/ Fetch the data from the given URL and decode it.\r\n  \/\/ This is performed on the concurrent thread pool to\r\n  \/\/ keep the main actor free while decoding large images.\r\n  @concurrent\r\n  static func fetchImage(at url: URL) async throws -> Image {\r\n    let (data, _) = try await URLSession.shared.data(from: url)\r\n    return await decode(data: data)\r\n  }\r\n}<code>\r\n\r\n<\/pre>\n<h2>\u5b89\u5168\u306a\u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0<\/h2>\n<p>\u4e88\u6e2c\u53ef\u80fd\u306a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u5c0f\u9650\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u3067\u5b9f\u73fe\u3059\u308b\u3001\u5b89\u5168\u306a\u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u305f\u3081\u306e\u6a5f\u80fd\u3082\u5c0e\u5165\u3055\u308c\u3066\u3044\u307e\u3059\u3002<strong>InlineArray<\/strong> \u306f\u3001\u8981\u7d20\u3092\u30a4\u30f3\u30e9\u30a4\u30f3\u3067\u683c\u7d0d\u3059\u308b\u65b0\u3057\u3044\u56fa\u5b9a\u30b5\u30a4\u30ba\u914d\u5217\u3067\u3001\u30b9\u30bf\u30c3\u30af\u4e0a\u306b\u8ffd\u52a0\u306e\u30d2\u30fc\u30d7\u5272\u308a\u5f53\u3066\u306a\u3057\u306b\u76f4\u63a5\u683c\u7d0d\u3067\u304d\u307e\u3059\u3002\u30a4\u30f3\u30e9\u30a4\u30f3\u914d\u5217\u306f\u3001\u8981\u7d20\u306e\u524d\u306b\u89d2\u62ec\u5f27\u3067\u56f2\u3093\u3060\u30b5\u30a4\u30ba\u3092\u8a18\u8ff0\u3059\u308b\u304b\u3001\u6b21\u306e\u7701\u7565\u5f62\u69cb\u6587\u3092\u4f7f\u7528\u3057\u3066\u5c0e\u5165\u3067\u304d\u307e\u3059:<\/p>\n<pre>\r\nstruct Game {\r\n  \/\/ Shorthand for InlineArray<40, Sprite>\r\n  var bricks: [40 of Sprite]\r\n\r\n  init(_ brickSprite: Sprite) {\r\n    bricks = .init(repeating: brickSprite)\r\n  }\r\n}\r\n<\/pre>\n<p>\u30dd\u30a4\u30f3\u30bf\u306e\u4ee3\u66ff\u3068\u3057\u3066\u3001\u5b89\u5168\u304b\u3064\u9ad8\u901f\u306a\u30e1\u30e2\u30ea\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3059\u308bSpan\u578b\u3084\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u91cd\u8996\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5411\u3051\u306b\u3001\u5371\u967a\u306a\u30b3\u30fc\u30c9\u4f7f\u7528\u3092\u8b66\u544a\u3059\u308b\u53b3\u5bc6\u306a\u30e1\u30e2\u30ea\u5b89\u5168\u6027\u3092\u30aa\u30d7\u30c8\u30a4\u30f3\u3067\u5c0e\u5165\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u958b\u767a\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u306e\u6539\u5584\u3082<\/h2>\n<p>\u305d\u306e\u4ed6\u3001VS Code\u62e1\u5f35\u6a5f\u80fd\u306e\u5f37\u5316\u3084\u3001\u8b66\u544a\u5236\u5fa1\u306e\u7cbe\u5bc6\u5316\u3001\u30de\u30af\u30ed\u30d3\u30eb\u30c9\u306e\u9ad8\u901f\u5316\u306a\u3069\u3082\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u30c6\u30b9\u30c8\u3068\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u6539\u826f\u3082\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n<p><span><strong>Subprocess\u30d1\u30c3\u30b1\u30fc\u30b8<\/strong>\uff1a\u975e\u540c\u671f\u5bfe\u5fdc\u306e\u5916\u90e8\u30d7\u30ed\u30bb\u30b9\u7ba1\u7406API\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span><strong>Foundation\u306e\u901a\u77e5API\u5237\u65b0<\/strong>\uff1a\u578b\u5b89\u5168\u306a\u901a\u77e5\u69cb\u9020\u4f53\u3067\u30a8\u30e9\u30fc\u3092\u9632\u6b62\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span><strong>Observation\u306e\u5f37\u5316<\/strong>\uff1aUI\u66f4\u65b0\u306e\u5197\u9577\u6027\u3092\u6392\u9664\u3057\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u5411\u4e0a\u3002<\/span><\/p>\n<\/li>\n<li>\n<p><span><strong>Swift Testing\u306e\u65b0\u6a5f\u80fd<\/strong>\uff1a\u7d42\u4e86\u6761\u4ef6\u30c6\u30b9\u30c8\u3084\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u306b\u3088\u308b\u8a73\u7d30\u306a\u5931\u6557\u5206\u6790\u304c\u53ef\u80fd\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<p>\u3055\u3089\u306b\u3001Wasm\uff08WebAssembly\uff09\u3078\u306e\u5bfe\u5fdc\u304c\u8ffd\u52a0\u3055\u308c\u3001\u30d6\u30e9\u30a6\u30b6\u3084\u30b5\u30fc\u30d0\u30fc\u5411\u3051\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Swift 6.2\u306f\u3001\u3088\u308a\u5b89\u5168\u3067\u52b9\u7387\u7684\u306a\u958b\u767a\u4f53\u9a13\u3092\u63d0\u4f9b\u3059\u308b\u305f\u3081\u3055\u307e\u3056\u307e\u306a\u6539\u826f\u304c\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002iOS\u3084iPadOS\u3001macOS\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u65b9\u306f\u8981\u30c1\u30a7\u30c3\u30af\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apple\u306f9\u670815\u65e5(\u73fe\u5730\u6642\u9593)\u3001Swift 6.2\u3092\u6b63\u5f0f\u306b\u30ea\u30ea\u30fc\u30b9\u3057\u307e\u3057\u305f(\u516c\u5f0f\u30d6\u30ed\u30b0)\u3002 \u4eca\u56de\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306f\u3001\u3059\u3079\u3066\u306eSwift\u958b\u767a\u8005\u306e\u751f\u7523\u6027\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u3092\u76ee\u7684\u3068\u3057\u305f\u3082\u306e\u3067\u3001\u8a00\u8a9e\u4ed5\u69d8\u304b\u3089\u30c4\u30fc\u30eb\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u3001\u30c7 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":130840,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[75],"tags":[85,2420],"class_list":["post-130839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-apple","tag-swift"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/130839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=130839"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/130839\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/130840"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=130839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=130839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=130839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}