Skip to content

Commit

Permalink
Merge pull request #1072 from DroidKaigi/kenken/add_picker_to_switch_…
Browse files Browse the repository at this point in the history
…contribution_views

[iOS] add a picker to switch SwiftUI-based and Compose-based views
  • Loading branch information
Ryoya Ito authored Sep 3, 2023
2 parents 8aba1b7 + 6e08013 commit dbd1a4d
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions app-ios/Modules/Sources/Contributor/ContributorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,33 @@ import SwiftUI
public struct ContributorView: View {
@State var presentingURL: IdentifiableURL?

@State private var selection: ViewType = .swiftUi
private enum ViewType {
case swiftUi
case compose
}

public init() {}

public var body: some View {
Group {
// ContributorSwiftUIView { url in
// presentingURL = .init(string: url)
// }
VStack {
Picker("select view type", selection: $selection) {
Text("SwiftUI").tag(ViewType.swiftUi)
Text("Compose").tag(ViewType.compose)
}
.pickerStyle(.segmented)

ContributorComposeView { url in
presentingURL = .init(string: url)
switch selection {
case .swiftUi:
ContributorSwiftUIView { url in
presentingURL = .init(string: url)
}
case .compose:
ContributorComposeView { url in
presentingURL = .init(string: url)
}
}
Spacer()
}
.navigationTitle("Contributor")
.sheet(item: $presentingURL) { url in
Expand Down

0 comments on commit dbd1a4d

Please sign in to comment.