SwiftUIのTips

1.8K Views

July 14, 24

スライド概要

自己紹介に利用した資料

profile-image

iOSアプリの開発をしています。 個人アプリも色々あります。 # Type: https://type-markdown.app WebCollector: https://webcollector.app/ Pity: https://freetimepicker.firebaseapp.com

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

SwiftUIのUI Tips かっくん @fromkk

2.

iPadの擬似 readableContentGuide

3.
[beta]
import SwiftUI
extension View {
@ViewBuilder
public func contentGuide(_ width: CGFloat = 432) -> some View {
HStack(spacing: 0) {
Spacer(minLength: 0)
self
.frame(maxWidth: width, alignment: .center)
Spacer(minLength: 0)
}
.frame(maxWidth: .infinity)
}
}

4.

グラスグラデーション https://zenn.dev/fromkk/articles/6bde4249650d61

5.
[beta]
public struct NavigationBarBackgrounView: View {
public init() {}
let maxHeight: CGFloat = 160
public var body: some View {
ZStack {
Color.clear
.background(.regularMaterial)
.frame(maxWidth: .infinity, maxHeight: maxHeight)
LinearGradient(
gradient: Gradient(colors: [.black.opacity(0), .black]),
startPoint: .top,
endPoint: .bottom
)
.blendMode(.destinationOut)
.frame(maxWidth: .infinity, maxHeight: maxHeight)
}
.compositingGroup()
.frame(maxHeight: maxHeight)
.ignoresSafeArea()
.allowsHitTesting(false)
}
}
extension View {
@ViewBuilder
public func blurNavigationBar() -> some View {
ZStack(alignment: .top) {
self
NavigationBarBackgrounView()
}
}