diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/About AudioKit/AboutAudioKitContentView.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/About AudioKit/AboutAudioKitContentView.swift new file mode 100644 index 0000000..5d82fbf --- /dev/null +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/About AudioKit/AboutAudioKitContentView.swift @@ -0,0 +1,33 @@ +import SwiftUI + +struct AboutAudioKitContentView: View { + private let maxWidth: CGFloat = 200 + var stackSpacing: CGFloat + + var body: some View { + audioKitArtwork + audioKitText + } + + private var audioKitArtwork: some View { + return VStack(spacing: stackSpacing) { + Image("audiokit-icon") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(maxWidth: maxWidth) + Image("audiokit-logo") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(maxWidth: maxWidth) + } + } + + private var audioKitText: some View { + Text("AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS, and tvOS.\n\nMost of the examples that were inside of AudioKit are now in this application.\n\nIn addition to the resources found here, there are various open-source example projects on GitHub and YouTube created by AudioKit contributors.") + .padding() + } +} + +#Preview { + AboutAudioKitContentView(stackSpacing: 25) +} diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/About AudioKit/AudioKitInfoView.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/About AudioKit/AudioKitInfoView.swift new file mode 100644 index 0000000..b597b61 --- /dev/null +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/About AudioKit/AudioKitInfoView.swift @@ -0,0 +1,37 @@ +import SwiftUI + +struct AudioKitInfoView: View { + @Environment(\.dismiss) var dismiss + @Environment(\.verticalSizeClass) var verticalSizeClass + @Environment(\.dynamicTypeSize) var dynamicTypeSize + let stackSpacing: CGFloat = 25 + var body: some View { + NavigationStack { + ScrollView { + if verticalSizeClass == .regular { + VStack(spacing: stackSpacing) { + AboutAudioKitContentView(stackSpacing: stackSpacing) + } + } else { + HStack(spacing: stackSpacing) { AboutAudioKitContentView(stackSpacing: stackSpacing) + } + } + } + .toolbar { + ToolbarItem(placement: .primaryAction) { + Button { + dismiss() + } label: { + Text("Done") + .fontWeight(.semibold) + } + .accessibilityHint("Tap to close this screen.") + } + } + } + } +} + +#Preview { + AudioKitInfoView() +} diff --git a/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift b/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift index f34c7a1..42d0842 100644 --- a/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift +++ b/Cookbook/CookbookCommon/Sources/CookbookCommon/ContentView.swift @@ -241,10 +241,8 @@ struct MasterView: View { Image(systemName: "info.circle") } } - .alert("AudioKit Cookbook", isPresented: $showingInfo) { - Button("OK", role: .cancel) { } - } message: { - Text("AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS, and tvOS.\n\nMost of the examples that were inside of AudioKit are now in this application.\n\nIn addition to the resources found here, there are various open-source example projects on GitHub and YouTube created by AudioKit contributors.") + .sheet(isPresented: $showingInfo) { + AudioKitInfoView() } } }