From 25478022110720270cf9072120eb07befecb5852 Mon Sep 17 00:00:00 2001 From: kenken <43767445+tkhs0604@users.noreply.github.com> Date: Sun, 3 Sep 2023 23:59:25 +0900 Subject: [PATCH 1/2] add a picker to switch SwiftUI-based and Compose-based views --- .../Sources/Contributor/ContributorView.swift | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/app-ios/Modules/Sources/Contributor/ContributorView.swift b/app-ios/Modules/Sources/Contributor/ContributorView.swift index 10e7f12eb..3acd7acc7 100644 --- a/app-ios/Modules/Sources/Contributor/ContributorView.swift +++ b/app-ios/Modules/Sources/Contributor/ContributorView.swift @@ -7,17 +7,33 @@ import SwiftUI public struct ContributorView: View { @State var presentingURL: IdentifiableURL? + @State private var selection: ViewType = .swiftUi + private enum ViewType: Hashable { + 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 From 6e08013a5e0cda66dcb9cebccb08b27910c1f76e Mon Sep 17 00:00:00 2001 From: kenken <43767445+tkhs0604@users.noreply.github.com> Date: Mon, 4 Sep 2023 01:18:41 +0900 Subject: [PATCH 2/2] remove unnecessary Hashable --- app-ios/Modules/Sources/Contributor/ContributorView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-ios/Modules/Sources/Contributor/ContributorView.swift b/app-ios/Modules/Sources/Contributor/ContributorView.swift index 3acd7acc7..b32cd4e6a 100644 --- a/app-ios/Modules/Sources/Contributor/ContributorView.swift +++ b/app-ios/Modules/Sources/Contributor/ContributorView.swift @@ -8,7 +8,7 @@ public struct ContributorView: View { @State var presentingURL: IdentifiableURL? @State private var selection: ViewType = .swiftUi - private enum ViewType: Hashable { + private enum ViewType { case swiftUi case compose }