Skip to content

Commit

Permalink
Merge pull request #162 from markjeschke/markj/convert-about-audiokit…
Browse files Browse the repository at this point in the history
…-info-to-sheet-view

Converted About AudioKit info from alert to sheet view
  • Loading branch information
NickCulbertson committed Jul 4, 2024
2 parents 23e2d1f + e474949 commit e004e20
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
@@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}
Expand Down

0 comments on commit e004e20

Please sign in to comment.