Skip to content

Instantly share code, notes, and snippets.

@takoikatakotako
Created October 24, 2024 01:09
Show Gist options
  • Select an option

  • Save takoikatakotako/63ed7c883466161f7b1240d917621446 to your computer and use it in GitHub Desktop.

Select an option

Save takoikatakotako/63ed7c883466161f7b1240d917621446 to your computer and use it in GitHub Desktop.
スワイプで遷移するチュートリアル画面を作る
import SwiftUI
struct ContentView: View {
var body: some View {
TabView {
ContentViewCell(image: Image(.snorlax))
ContentViewCell(image: Image(.magnemite))
ContentViewCell(image: Image(.psyduck))
ContentViewCell(image: Image(.quagsire))
ContentViewCell(image: Image(.slowpoke))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.gray)
.tabViewStyle(.page)
.menuIndicator(.visible)
}
}
import SwiftUI
struct ContentViewCell: View {
let image: Image
var body: some View {
image
.resizable()
.scaledToFit()
.frame(width: 240, height: 240)
.background(Color.white)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment