Communitygithub.com

SwiftUI 26 機能

iOS 26、iPadOS 26、macOS Tahoe、watchOS 26、visionOS 26 向けの新しい SwiftUI 機能を網羅した包括的なガイドです。Liquid Glass デザインシステム、パフォーマンス改善、@Animatable マクロ、3D 空間レイアウト、シーンブリッジング、WebView/WebPage、AttributedString リッチテキスト編集、ドラッグ&ドロップの拡張、visionOS 連携などをカバーします。

SwiftUI 26 機能 とは?

このスキルは、Apple のオペレーティングシステム最新バージョン(iOS 26、iPadOS 26、macOS Tahoe、watchOS 26、visionOS 26)向け SwiftUI の新機能を詳述したものです。Liquid Glass デザインシステムの採用から、リッチテキスト編集、パフォーマンス改善、visionOS の 3D 空間レイアウトまで、幅広いトピックを扱います。特に、@Animatable マクロによるカスタムアニメーション、WebView と WebPage を使用したウェブコンテンツ埋め込み、AttributedString による高度なテキスト編集、複数アイテムのドラッグ&ドロップなどの実装方法を具体的なコード例とともに解説します。また、ツールバー、スライダー、ボタンの新たなカスタマイズオプションや、リスト・スクロールパフォーマンスの大幅な向上についてもカバーしており、これらの新機能を活用するための実践的な知識を提供します。このスキルは Claude Code、Cursor、Codex などの AI エージェントで使用でき、iOS/macOS アプリ開発者が最新の SwiftUI 機能を迅速に習得し、効率的に実装するのに役立ちます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/CharlesWiltgen/Axiom/axiom-swiftui-26-ref

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

SwiftUI 26 機能 は何をしますか?

概要

iOS 26、iPadOS 26、macOS Tahoe、watchOS 26、visionOS 26 における SwiftUI の新機能を網羅した包括的なガイドです。Liquid Glass デザインシステムからリッチテキスト編集まで、これらの拡張機能は、すべての Apple プラットフォームで SwiftUI をより強力にします。

基本原則: 低レベルのパフォーマンス改善からユーザーインターフェイスのボタンに至るまで、システム全体にわたって大きな改善が加えられています。

このスキルを使用するタイミング

  • Liquid Glass デザインシステムの採用
  • AttributedString を使用したリッチテキスト編集の実装
  • WebView を使用したウェブコンテンツの埋め込み
  • リストとスクロールのパフォーマンス最適化
  • カスタムアニメーションのための @Animatable マクロの使用
  • visionOS での 3D 空間レイアウトの構築
  • SwiftUI シーンから UIKit/AppKit アプリへのブリッジ
  • 複数アイテムのドラッグ&ドロップの実装
  • Chart3D を使用した 3D チャートの作成
  • visionOS または CarPlay へのウィジェット追加
  • スライダーへのカスタム目盛り追加(チャプターマーカー、値インジケーター)
  • enabledBounds を使用したスライダー選択範囲の制限
  • スライダー外観のカスタマイズ(サムの可視性、現在値ラベル)
  • ぼかし効果付きスティッキーセーフエリアバーの作成
  • アプリ内ブラウザでの URL 開封
  • システムスタイルの閉じるボタンと確認ボタンの使用
  • ガラスボタンスタイルの適用(iOS 26.1+)
  • ボタンサイズ設定の動作制御
  • コンパクト検索ツールバーの実装
  • テキストの行間またはベースライン間隔の調整

システム要件

iOS 26+、iPadOS 26+、macOS Tahoe+、watchOS 26+、visionOS 26+


Liquid Glass デザインシステム

包括的なカバレッジについては、axiom-liquid-glass(デザイン原則、バリアント、レビュープレッシャー)および axiom-liquid-glass-ref(アプリ全体の採用ガイド)を参照してください。このセクションでは、WWDC 256 固有の API のみをカバーします。

自動採用

iOS 26 SDK で再コンパイルするだけで、ナビゲーションコンテナ、タブバー、ツールバー、トグル、セグメントピッカー、スライダーが自動的に新しいデザインを採用します。ボーダー付きボタンはデフォルトでカプセル形状になります。シートは Liquid Glass 背景を取得します(presentationBackground のカスタマイズは削除してください)。

ツールバー API(iOS 26)

ToolbarSpacer

.toolbar {
    ToolbarItem(placement: .bottomBar) { Button("アーカイブ", systemImage: "archivebox") { } }
    ToolbarSpacer(.flexible, placement: .bottomBar)  // アイテムを引き離す
    ToolbarItem(placement: .bottomBar) { Button("作成", systemImage: "square.and.pencil") { } }
}
// .fixed はグループを視覚的に分離; .flexible は HStack の Spacer のように引き離す

ToolbarItemGroup(視覚的なグループ化)

ToolbarItemGroup 内のアイテムは単一のガラス背景「ピル」を共有します。ToolbarItemPlacement で視覚的な外観を制御します: confirmationAction → glassProminent スタイル、cancellationAction → 標準ガラス。.sharedBackgroundVisibility(.hidden) を使用して、アイテム(例: アバター)をグループ背景から除外します。

ツールバーのモーフィング

NavigationStack 自体ではなく、NavigationStack 内の個々のビューに .toolbar {} をアタッチします。iOS 26 はプッシュ/ポップ中にビューごとのツールバー間でモーフィングします。安定した状態を保つべきアイテム(バウンスなし)には、画面上で一致する ToolbarItem(id:) と共に toolbar(id:) を使用します:

// MailboxList
.toolbar(id: "main") {
    ToolbarItem(id: "filter", placement: .bottomBar) { Button("フィルター") { } }
    ToolbarSpacer(.flexible, placement: .bottomBar)
    ToolbarItem(id: "compose", placement: .bottomBar) { Button("新規メッセージ") { } }
}
// MessageList — "filter" は存在しない(アニメーションアウト)、"compose" は安定
.toolbar(id: "main") {
    ToolbarSpacer(.flexible, placement: .bottomBar)
    ToolbarItem(id: "compose", placement: .bottomBar) { Button("新規メッセージ") { } }
}

#1 の落とし穴: NavigationStack 上のツールバー = モーフィングするものがない。

DefaultToolbarItem

システム提供のアイテム(検索など)をツールバーレイアウト内に再配置します:

DefaultToolbarItem(kind: .search, placement: .bottomBar)
// 一致する種類のシステムデフォルト配置を置き換える

折りたたまれた NavigationSplitView サイドバーで使用して、iPhone で検索を表示する列を指定します。後方互換性のために if #available(iOS 26.0, *) でラップします。

ユーザーカスタマイズ可能なツールバー

toolbar(id:) により、ユーザーによるカスタマイズ(並べ替え、表示/非表示)が可能になります。iPadOS では .secondaryAction アイテムのみカスタマイズをサポートします。オプションのアイテムには showsByDefault: false を使用します。macOS メニューアイテムには ToolbarCommands() を追加します。

その他のツールバー機能

  • .navigationSubtitle("3 未読") — タイトルの下のセカンダリ行
  • ツールバーアイテムの .badge(3) — 通知数
  • モノクロームアイコン描画 — 視覚的なノイズを低減; 意味のために色合いを、装飾のためには使用しない
  • スクロールエッジのぼかし — コード不要で自動

下部配置検索

基本検索 API: axiom-swiftui-search-ref を参照してください。このセクションでは iOS 26 の改良のみをカバーします。

NavigationSplitView {
    List { }.searchable(text: $searchText)
}
// iPhone では下部配置、iPad では右上配置(自動)
// placement: .sidebar を使用して iPad のサイドバー埋め込み検索を復元する
  • searchToolbarBehavior(.minimize) — タップで展開するコンパクト検索
  • Tab(role: .search) — 専用検索タブ; 検索フィールドがタブバーを置き換えます。swiftui-nav-ref セクション 5.7 を参照

カスタムビューのガラス効果

Button("トップへ", systemImage: "chevron.up") { scrollToTop() }
    .padding()
    .glassEffect()  // iOS でのカスタムコントロールには .interactive を追加
  • GlassEffectContainer — 複数のガラス要素が近くにある場合に必要(ガラスはガラスをサンプリングできない)
  • glassEffectID(_:in:) — 名前空間を使用してガラス要素間の流動的なモーフィング遷移
  • シートのモーフィング — .matchedTransitionSource + .navigationTransition(.zoom(...)) を使用してボタンからシートをモーフィングする

ボタンとコントロールの変更

  • ボーダー付きボタンのデフォルトはカプセル形状(.buttonBorderShape(.roundedRectangle) でオーバーライド)
  • .controlSize(.extraLarge) — 新しい特大ボタンサイズ
  • コンテナ上の .controlSize(.small) — iOS 26 以前の密度を維持
  • GlassButtonStyle(.clear/.glass/.tint) — ガラスボタンバリアント(iOS 26.1+)
  • .buttonSizing(.fit/.stretch/.flexible) — ボタンレイアウト動作の制御
  • Button(role: .close) / Button(role: .confirm) — システムスタイルの閉じる/確認
  • .clipShape(.rect(cornerRadius: 12, style: .containerConcentric)) — コーナーの同心性
  • メニュー: 先頭端にアイコン、iOS/macOS で一貫性

スライダーの拡張

iOS 26 では、カスタム目盛り、制限された選択範囲、現在値ラベル、サムの可視性制御が追加されました。

スライダーの目盛り

コアタイプ: SliderTick<V>、SliderTickContentForEach、SliderTickBuilder

// ラベル付き静的目盛り
Slider(value: $value, in: 0...10) {
    Text("評価")
} ticks: {
    SliderTick(0) { Text("最小") }
    SliderTick(5) { Text("中間") }
    SliderTick(10) { Text("最大") }
}

// コレクションからの動的目盛り
SliderTickContentForEach(stops, id: \.self) { value in
    SliderTick(value) { Text("\(Int(value))°").font(.caption2) }
}

// ステップベースの目盛り(各ステップ値に対して呼び出される)
Slider(value: $volume, in: 0...10, step: 2, label: { Text("ボリューム") }, tick: { value in
    SliderTick(value) { Text("\(Int(value))") }
})

API 制約: SliderTickContentForEach は Data.Element が SliderTick<V> の値型と一致する必要があります。カスタム構造体の場合は、数値を抽出します: chapters.map(\.time) その後 chapters.first(where: { $0.time == time }) でラベルを検索します。

フル機能スライダー

Slider(
    value: $rating, in: 0...100,
    neutralValue: 50,           // 開始点 / 中央値
    enabledBounds: 20...80,     // 選択可能範囲を制限
    label: { Text("評価") },
    currentValueLabel: { Text("\(Int(rating))") },
    minimumValueLabel: { Text("0") },
    maximumValueLabel: { Text("100") },
    ticks: { SliderTick(50) { Text("中間") } },
    onEditingChanged: { editing in print(editing ? "開始" : "終了") }
)

sliderThumbVisibility

.sliderThumbVisibility(.hidden) — メディア進行状況インジケーターやミニマル UI でサムを非表示にします。オプション: .automatic、.visible、.hidden。watchOS では常に表示されます。


新しいビューモディファイア

safeAreaBar

統合されたプログレッシブぼかし付きのスティッキーバー:

List { ForEach(1...20, id: \.self) { Text("\($0). アイテム") } }
    .safeAreaBar(edge: .bottom) {
        Text("ボトムアクションバー").padding(.vertical, 15)
    }
    .scrollEdgeEffectStyle(.soft, for: .bottom) // または .hard

safeAreaInset と同様に機能しますが、ぼかしが追加されています。バーは固定されたまま、コンテンツはその下をスクロールします。

onOpenURL の拡張

@Environment(\.openURL) var openURL
// openURL(url, prefersInApp: true) — SFSafariViewController スタイルのアプリ内ブラウザで開く
// デフォルトの Link は Safari で開きます; prefersInApp はユーザーをアプリ内に留めます

searchToolbarBehavior

基本的な .searchable API については axiom-swiftui-search-ref を参照してください。iOS 26 では以下が追加されています:

.searchable(text: $searchText)
.searchToolbarBehavior(.minimize)  // コンパクトボタン、タップで展開

また: .searchPresentationToolbarBehavior(.avoidHidingContent)(iOS 17.1+)は、検索中もタイトルを表示したままにします。

iOS 18+26 をターゲットとするアプリの後方互換ラッパー:

extension View {
    @ViewBuilder func minimizedSearch() -> some View {
        if #available(iOS 26.0, *) {
            self.searchToolbarBehavior(.minimize)
        } else { self }
    }
}

// 使用法
.searchable(text: $searchText)
.minimizedSearch()

ツールバーアイテムの可用性パターン:

.toolbar {
    if #available(iOS 26.0, *) {
        DefaultToolbarItem(kind: .search, placement: .bottomBar)
        ToolbarSpacer(.flexible, placement: .bottomBar)
    }
    ToolbarItem(placement: .bottomBar) {
        NewNoteButton()
    }
}
.searchable(text: $searchText)

ボタンのロール、GlassButtonStyle、buttonSizing — 上記の Liquid Glass デザインシステムのセクションを参照してください。

lineHeight(iOS 26)

テキスト行のベースライン間の距離を設定します。lineSpacing()(行の下端から次の行の上端を測定)よりも直感的です。

プリセット

Text("Lorem ipsum...")
    .lineHeight(.loose)     // オープンレイアウトのための間隔拡大
    .lineHeight(.tight)     // コンパクトレイアウトのための間隔縮小
    .lineHeight(.normal)    // ポイントサイズの倍数に基づく一定の高さ
    .lineHeight(.variable)  // フォントメトリクスを使用した高さ計算

精密な制御

// フォントサイズに比例して拡大縮小
Text("テキストサイズに合わせて拡大縮小")
    .lineHeight(.multiple(factor: 2))

// 固定増加分を含むポイントサイズ相対
Text("ポイントサイズ相対")
    .lineHeight(.leading(increase: 30))

// 絶対固定値 — Dynamic Type では拡大縮小しない
Text("固定高さ")
    .lineHeight(.exact(points: 30))

AttributedString サポート

var s = AttributedString("段落\n複数行\nのテキスト。")
s.lineHeight = .exact(points: 32)
s.lineHeight = .multiple(factor: 2.5)
s.lineHeight = .loose

既存 API との比較

API測定対象利用可能
.lineHeight()ベースライン間iOS 26+
.lineSpacing()行の下端から次の行の上端iOS 13+
.font(.body.leading(.tight))フォントレベルの行送りプリセットiOS 14+

相互参照: axiom-typography-ref — Dynamic Type、トラッキング、国際化を含む完全なタイポグラフィシステム


iPad の拡張

メニューバー

スワイプダウンメニューから共通アクションにアクセス

.commands {
    TextEditingCommands() // macOS メニューバーと同じ API

    CommandGroup(after: .newItem) {
        Button("メモを追加") {
            addNote()
        }
        .keyboardShortcut("n", modifiers: [.command, .shift])
    }
}
// ユーザーがスワイプダウンしたときに iPad にメニューバーを作成

サイズ変更可能なウィンドウ

iPad での流動的なサイズ変更

// 移行必須:
// iPadOS 26 で非推奨のプロパティリストキーを削除:
// UIRequiresFullscreen(キー全体が非推奨、すべての値)

// 分割ビューナビゲーションの場合、システムはサイズ変更中に利用可能なスペースに基づいて
// 列を自動的に表示/非表示にする
NavigationSplitView {
    Sidebar()
} detail: {
    Detail()
}
// サイズ変更に自動的に適応

参考文献: 「iPad アプリのデザインを向上させる」(WWDC 2025)


macOS ウィンドウの拡張

同期されたウィンドウリサイズアニメーション

.windowResizeAnchor(.topLeading) // アニメーションの発信元を調整

// SwiftUI はコンテンツビューのサイズ変更とウィンドウのリサイズの間の
// アニメーションを同期するようになりました - タブ切り替え時の連続性を維持するのに最適

パフォーマンスの改善

リストパフォーマンス(macOS に焦点)

大規模リストの大幅な高速化

  • macOS で 100,000 以上のアイテムを含むリストの 6 倍高速な読み込み
  • 大規模リストの 16 倍高速な更新
  • より大きなリストではさらに大きな向上
  • 改善はすべてのプラットフォーム(iOS、iPadOS、watchOS)にメリットをもたらす
List(trips) { trip in // 10万以上のアイテム
    TripRow(trip: trip)
}
// macOS で 6 倍高速に読み込み、16 倍高速に更新(iOS 26+)

スクロールパフォーマンス

ドロップフレームの削減

SwiftUI は iOS と macOS でのユーザーインターフェイス更新のスケジューリングを改善しました。これにより応答性が向上し、SwiftUI が今後のフレームに備えてさらに多くの作業を実行できるようになります。全体として、高速フレームレートで素早くスクロールしているときにアプリがフレームをドロップする可能性が減少します。

遅延スタックを使用したネストされた ScrollView

フォトカルーセルとマルチ軸スクロール

ScrollView(.horizontal) {
    LazyHStack {
        ForEach(photoSets) { photoSet in
            ScrollView(.vertical) {
                LazyVStack {
                    ForEach(photoSet.photos) { photo in
                        PhotoView(photo: photo)
                    }
                }
            }
        }
    }
}
// ネストされたスクロールビューは、遅延スタックで読み込みを適切に遅延させるようになりました
// フォトカルーセルの構築に最適

SwiftUI パフォーマンスインストルメント

Xcode の新しいプロファイリングツール

利用可能なレーン:

  • Long view body updates — 高コストな body 計算の特定
  • Platform view updates — プラットフォームビュー更新の追跡

...

[翻訳はここで切り詰められました]

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

関連スキル