Skip to content

Commit 54c4c45

Browse files
committed
Cooler demo
1 parent 0112fc8 commit 54c4c45

File tree

5 files changed

+135
-15
lines changed

5 files changed

+135
-15
lines changed

Demo/Demo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
223223
GCC_WARN_UNUSED_FUNCTION = YES;
224224
GCC_WARN_UNUSED_VARIABLE = YES;
225-
MACOSX_DEPLOYMENT_TARGET = 10.15;
225+
MACOSX_DEPLOYMENT_TARGET = 11.0;
226226
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
227227
MTL_FAST_MATH = YES;
228228
ONLY_ACTIVE_ARCH = YES;
@@ -277,7 +277,7 @@
277277
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
278278
GCC_WARN_UNUSED_FUNCTION = YES;
279279
GCC_WARN_UNUSED_VARIABLE = YES;
280-
MACOSX_DEPLOYMENT_TARGET = 10.15;
280+
MACOSX_DEPLOYMENT_TARGET = 11.0;
281281
MTL_ENABLE_DEBUG_INFO = NO;
282282
MTL_FAST_MATH = YES;
283283
SDKROOT = macosx;
@@ -301,7 +301,7 @@
301301
"$(inherited)",
302302
"@executable_path/../Frameworks",
303303
);
304-
MACOSX_DEPLOYMENT_TARGET = 10.15;
304+
MACOSX_DEPLOYMENT_TARGET = 11.0;
305305
PRODUCT_BUNDLE_IDENTIFIER = com.ichigo.Fretboard.Demo;
306306
PRODUCT_NAME = "$(TARGET_NAME)";
307307
SWIFT_VERSION = 5.0;
@@ -323,7 +323,7 @@
323323
"$(inherited)",
324324
"@executable_path/../Frameworks",
325325
);
326-
MACOSX_DEPLOYMENT_TARGET = 10.15;
326+
MACOSX_DEPLOYMENT_TARGET = 11.0;
327327
PRODUCT_BUNDLE_IDENTIFIER = com.ichigo.Fretboard.Demo;
328328
PRODUCT_NAME = "$(TARGET_NAME)";
329329
SWIFT_VERSION = 5.0;

Demo/Demo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1230"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "DE0B4A6E25BFB80E007F4A4B"
18+
BuildableName = "Demo.app"
19+
BlueprintName = "Demo"
20+
ReferencedContainer = "container:Demo.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "DE0B4A6E25BFB80E007F4A4B"
48+
BuildableName = "Demo.app"
49+
BlueprintName = "Demo"
50+
ReferencedContainer = "container:Demo.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "DE0B4A6E25BFB80E007F4A4B"
65+
BuildableName = "Demo.app"
66+
BlueprintName = "Demo"
67+
ReferencedContainer = "container:Demo.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

Demo/Demo/ContentView.swift

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,59 @@ import SwiftUI
99
import Fretboard
1010

1111
struct ContentView: View {
12+
@State private var selectedKey: GuitarChord.Key = .c
13+
@State private var selectedSuffix: GuitarChord.Suffix = .major
14+
15+
private let allChords: [GuitarChord]
16+
private let allKeys: [GuitarChord.Key]
17+
private let allSuffixes: [GuitarChord.Suffix]
18+
19+
private var columns: [GridItem] =
20+
Array(repeating: .init(.flexible()), count: 4)
21+
private var foundChords: [GuitarChord] {
22+
allChords.matching(key: selectedKey)
23+
.matching(suffix: selectedSuffix)
24+
}
25+
26+
init() {
27+
allChords = GuitarChord.all
28+
allKeys = Array(Set(allChords.keys))
29+
allSuffixes = Array(Set(allChords.suffixes))
30+
}
31+
1232
var body: some View {
13-
VStack {
14-
Text("C Major")
15-
.font(.headline)
16-
17-
FretView(fingers: [0, 3, 2, 0, 1, 0],
18-
strings: [-1, 3, 2, 0, 1, 0],
19-
barres: [])
20-
.frame(width: 100, height: 200)
33+
ScrollView {
34+
VStack {
35+
Text("Guitar Chord Lookup 🎸")
36+
.font(.largeTitle)
37+
.padding()
38+
39+
HStack {
40+
Picker("Select key", selection: $selectedKey) {
41+
ForEach(allKeys, id: \.self) {
42+
Text($0.rawValue)
43+
}
44+
}
45+
46+
Picker("Select suffix", selection: $selectedSuffix) {
47+
ForEach(allSuffixes, id: \.self) {
48+
Text($0.rawValue)
49+
}
50+
}
51+
}
52+
53+
LazyVGrid(columns: columns) {
54+
ForEach(foundChords, id: \.self) { chord in
55+
FretView(chord: chord)
56+
.frame(width: 100, height: 200)
57+
}
58+
}
59+
60+
Spacer()
61+
}
2162
}
22-
63+
.frame(width: 500, height: 300)
64+
.padding()
2365
}
2466
}
2567

screenshot.png

263 KB
Loading

0 commit comments

Comments
 (0)