Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ZStackとbackgroundの使い分け / Comparing ZStack and b...

ZStackとbackgroundの使い分け / Comparing ZStack and background

リョウ

July 10, 2024
Tweet

More Decks by リョウ

Other Decks in Programming

Transcript

  1. υΩϡϝϯτΛಡΉ :PVDBOBEEBWJFXBTBCBDLHSPVOEXJUI UIF CBDLHSPVOE @BMJHONFOU WJFXNPEJ fi FS5PBEEBCBDLHSPVOE VOEFSNVMUJQMFWJFXT PSUPIBWFBCBDLHSPVOEMBSHFSUIBOBO

    FYJTUJOHWJFX ZPVDBOMBZFSUIFWJFXTCZQMBDJOHUIFNXJUIJO B ;4UBDL BOEQMBDFUIFWJFXZPVXBOUUPCFJOUIFCBDLHSPVOEBU UIFCPUUPNPGUIFWJFXTUBDL:PVDBOTQFDJGZUIBUBCBDLHSPVOE WJFXTIPVMEJHOPSFUIFTBGFBSFBJOTFUTUPFYUFOEUIFCBDLHSPVOEUP TPNFPSBMMFEHFT IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOTXJGUVJBEEJOHBCBDLHSPVOEUPZPVSWJFX
  2. CBDLHSPVOE\^ @inlinable public func background<V>(alignment: Alignment = .center, @ViewBuilder content:

    () -> V) -> some View where V : View VStack { Spacer() Text("Text") .padding() .frame(maxWidth: .infinity) .background { Color.orange } }
  3. CBDLHSPVOE @inlinable public func background<S>(_ style: S, ignoresSafeAreaEdges edges: Edge.Set

    = .all) -> some View where S : ShapeStyle VStack { Spacer() Text("Text") .padding() .frame(maxWidth: .infinity) .background( Color.orange ) }