スワイプで遷移するチュートリアル画面を作る
スワイプで遷移するチュートリアル画面を作る方法です。

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentViewCell: View { | |
let image: Image | |
var body: some View { | |
image | |
.resizable() | |
.scaledToFit() | |
.frame(width: 240, height: 240) | |
.background(Color.white) | |
} | |
} |