Skip to content

Commit

Permalink
Updated example projects
Browse files Browse the repository at this point in the history
  • Loading branch information
orchetect committed Oct 17, 2024
1 parent 77cac22 commit c94d67b
Show file tree
Hide file tree
Showing 8 changed files with 237 additions and 41 deletions.
24 changes: 13 additions & 11 deletions Examples/Movie Timecode/Movie Timecode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
E2B3ADBB2CB1E65700149DEF /* TimecodeKit in Frameworks */ = {isa = PBXBuildFile; productRef = E2B3ADBA2CB1E65700149DEF /* TimecodeKit */; };
E2B3ADBD2CB1E65700149DEF /* TimecodeKitUI in Frameworks */ = {isa = PBXBuildFile; productRef = E2B3ADBC2CB1E65700149DEF /* TimecodeKitUI */; };
E212881E2CBDFD4200C6AB7D /* TimecodeKit in Frameworks */ = {isa = PBXBuildFile; productRef = E212881D2CBDFD4200C6AB7D /* TimecodeKit */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -24,18 +23,25 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E2B3ADBB2CB1E65700149DEF /* TimecodeKit in Frameworks */,
E2B3ADBD2CB1E65700149DEF /* TimecodeKitUI in Frameworks */,
E212881E2CBDFD4200C6AB7D /* TimecodeKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
E21287E22CBDEBF000C6AB7D /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
E2B3AD8D2CB1E50000149DEF = {
isa = PBXGroup;
children = (
E2B3AD982CB1E50000149DEF /* Movie Timecode */,
E21287E22CBDEBF000C6AB7D /* Frameworks */,
E2B3AD972CB1E50000149DEF /* Products */,
);
sourceTree = "<group>";
Expand Down Expand Up @@ -68,8 +74,7 @@
);
name = "Movie Timecode";
packageProductDependencies = (
E2B3ADBA2CB1E65700149DEF /* TimecodeKit */,
E2B3ADBC2CB1E65700149DEF /* TimecodeKitUI */,
E212881D2CBDFD4200C6AB7D /* TimecodeKit */,
);
productName = "Movie Timecode";
productReference = E2B3AD962CB1E50000149DEF /* Movie Timecode.app */;
Expand Down Expand Up @@ -358,14 +363,11 @@
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
E2B3ADBA2CB1E65700149DEF /* TimecodeKit */ = {
E212881D2CBDFD4200C6AB7D /* TimecodeKit */ = {
isa = XCSwiftPackageProductDependency;
package = E2B3ADB92CB1E65700149DEF /* XCLocalSwiftPackageReference "../../../TimecodeKit" */;
productName = TimecodeKit;
};
E2B3ADBC2CB1E65700149DEF /* TimecodeKitUI */ = {
isa = XCSwiftPackageProductDependency;
productName = TimecodeKitUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = E2B3AD8E2CB1E50000149DEF /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E2B3AD952CB1E50000149DEF"
BuildableName = "Movie Timecode.app"
BlueprintName = "Movie Timecode"
ReferencedContainer = "container:Movie Timecode.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E2B3AD952CB1E50000149DEF"
BuildableName = "Movie Timecode.app"
BlueprintName = "Movie Timecode"
ReferencedContainer = "container:Movie Timecode.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E2B3AD952CB1E50000149DEF"
BuildableName = "Movie Timecode.app"
BlueprintName = "Movie Timecode"
ReferencedContainer = "container:Movie Timecode.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ struct AddOrReplaceTimecodeTrackView: View {

TimecodeField(timecode: $newStartTimecode)
.timecodeFormat([.showSubFrames])
.timecodeSubFramesStyle(.secondary, scale: .secondary)
.timecodeValidationStyle(.red)
}

LabeledContent("") {
Button("Export") {
isFolderPickerShown = true
}
.keyboardShortcut(.defaultAction)
.disabled(!newStartTimecode.isValid)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct RemoveTimecodeTrackView: View {
Button("Export") {
isFolderPickerShown = true
}
.keyboardShortcut(.defaultAction)
}
}
.formStyle(.grouped)
Expand Down
16 changes: 5 additions & 11 deletions Examples/Timecode Math/Timecode Math.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
E21287892CBC839400C6AB7D /* TimecodeKit in Frameworks */ = {isa = PBXBuildFile; productRef = E21287882CBC839400C6AB7D /* TimecodeKit */; };
E212878B2CBC839400C6AB7D /* TimecodeKitUI in Frameworks */ = {isa = PBXBuildFile; productRef = E212878A2CBC839400C6AB7D /* TimecodeKitUI */; };
E2BCFBD82CC099DE00653C18 /* TimecodeKit in Frameworks */ = {isa = PBXBuildFile; productRef = E2BCFBD72CC099DE00653C18 /* TimecodeKit */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -28,8 +27,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E21287892CBC839400C6AB7D /* TimecodeKit in Frameworks */,
E212878B2CBC839400C6AB7D /* TimecodeKitUI in Frameworks */,
E2BCFBD82CC099DE00653C18 /* TimecodeKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -72,8 +70,7 @@
);
name = TimecodeMath;
packageProductDependencies = (
E21287882CBC839400C6AB7D /* TimecodeKit */,
E212878A2CBC839400C6AB7D /* TimecodeKitUI */,
E2BCFBD72CC099DE00653C18 /* TimecodeKit */,
);
productName = TimecodeMath;
productReference = E263C4D52CBC805D003233F6 /* TimecodeMath.app */;
Expand Down Expand Up @@ -360,14 +357,11 @@
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
E21287882CBC839400C6AB7D /* TimecodeKit */ = {
E2BCFBD72CC099DE00653C18 /* TimecodeKit */ = {
isa = XCSwiftPackageProductDependency;
package = E21287872CBC839400C6AB7D /* XCLocalSwiftPackageReference "../../../TimecodeKit" */;
productName = TimecodeKit;
};
E212878A2CBC839400C6AB7D /* TimecodeKitUI */ = {
isa = XCSwiftPackageProductDependency;
productName = TimecodeKitUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = E263C4CD2CBC805D003233F6 /* Project object */;
Expand Down
16 changes: 5 additions & 11 deletions Examples/Timecode UI/Timecode UI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
E2B3AE482CB238C900149DEF /* TimecodeKit in Frameworks */ = {isa = PBXBuildFile; productRef = E2B3AE472CB238C900149DEF /* TimecodeKit */; };
E2B3AE4A2CB238C900149DEF /* TimecodeKitUI in Frameworks */ = {isa = PBXBuildFile; productRef = E2B3AE492CB238C900149DEF /* TimecodeKitUI */; };
E2BCFBE92CC09AC400653C18 /* TimecodeKit in Frameworks */ = {isa = PBXBuildFile; productRef = E2BCFBE82CC09AC400653C18 /* TimecodeKit */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -41,8 +40,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E2B3AE482CB238C900149DEF /* TimecodeKit in Frameworks */,
E2B3AE4A2CB238C900149DEF /* TimecodeKitUI in Frameworks */,
E2BCFBE92CC09AC400653C18 /* TimecodeKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -85,8 +83,7 @@
);
name = "Timecode UI";
packageProductDependencies = (
E2B3AE472CB238C900149DEF /* TimecodeKit */,
E2B3AE492CB238C900149DEF /* TimecodeKitUI */,
E2BCFBE82CC09AC400653C18 /* TimecodeKit */,
);
productName = "TimecodeUI Example";
productReference = E2B3AE242CB2340100149DEF /* Timecode UI.app */;
Expand Down Expand Up @@ -375,14 +372,11 @@
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
E2B3AE472CB238C900149DEF /* TimecodeKit */ = {
E2BCFBE82CC09AC400653C18 /* TimecodeKit */ = {
isa = XCSwiftPackageProductDependency;
package = E2B3AE462CB238C900149DEF /* XCLocalSwiftPackageReference "../../../TimecodeKit" */;
productName = TimecodeKit;
};
E2B3AE492CB238C900149DEF /* TimecodeKitUI */ = {
isa = XCSwiftPackageProductDependency;
productName = TimecodeKitUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = E2B3AE1C2CB2340100149DEF /* Project object */;
Expand Down
77 changes: 69 additions & 8 deletions Examples/Timecode UI/Timecode UI/TimecodeFieldView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ struct TimecodeFieldView: View {
@State private var separatorStyle: SeparatorStyle = .secondary
@State private var highlightStyle: HighlightStyle = .default
@State private var validationStyle: ValidationStyle = .red
@State private var subFramesStyle: SubFramesStyle = .default
@State private var subFramesScale: TextScale = .default

@FocusState private var isEditing: Bool

Expand All @@ -36,6 +38,7 @@ struct TimecodeFieldView: View {
.foregroundColor(defaultStyle.color)
.timecodeFormat(timecodeFormat)
.timecodeSeparatorStyle(separatorStyle.color)
.timecodeSubFramesStyle(subFramesStyle.color, scale: subFramesScale.scale)
.timecodeValidationStyle(validationStyle.color)
.timecodeFieldHighlightStyle(highlightStyle.color)
.timecodeFieldInputStyle(inputStyle)
Expand Down Expand Up @@ -111,6 +114,16 @@ struct TimecodeFieldView: View {
Text(validationType.name).tag(validationType)
}
}
Picker("SubFrames Color", selection: $subFramesStyle) {
ForEach(SubFramesStyle.allCases) { style in
Text(style.name).tag(style)
}
}
Picker("SubFrames Scale", selection: $subFramesScale) {
ForEach(TextScale.allCases) { scale in
Text(scale.name).tag(scale)
}
}
}
}

Expand Down Expand Up @@ -209,6 +222,57 @@ extension TimecodeFieldView {
}
}

private enum SubFramesStyle: Int, CaseIterable, Identifiable {
case `default`
case primary
case secondary
case blue
case orange

var id: RawValue { rawValue }

var name: String {
switch self {
case .default: "Default"
case .primary: "Primary"
case .secondary: "Secondary"
case .blue: "Blue"
case .orange: "Orange"
}
}

var color: Color? {
switch self {
case .default: nil
case .primary: .primary
case .secondary: .secondary
case .blue: .blue
case .orange: .orange
}
}
}

private enum TextScale: String, CaseIterable, Identifiable {
case `default`
case secondary

var id: RawValue { rawValue }

var name: String {
switch self {
case .default: "Default"
case .secondary: "Secondary"
}
}

var scale: Text.Scale {
switch self {
case .default: .default
case .secondary: .secondary
}
}
}

private enum SeparatorStyle: Int, CaseIterable, Identifiable {
case `default`
case primary
Expand Down Expand Up @@ -291,21 +355,18 @@ extension TimecodeFieldView {
extension TimecodeField.InputStyle {
var name: String {
switch self {
case .autoAdvance:
return "Auto-Advance"
case .continuousWithinComponent:
return "Continuous"
case .unbounded:
return "Unbounded"
case .autoAdvance: "Auto-Advance"
case .continuousWithinComponent: "Continuous"
case .unbounded: "Unbounded"
}
}
}

extension TimecodeField.InputWrapping {
var name: String {
switch self {
case .noWrap: return "No Wrap"
case .wrap: return "Wrap"
case .noWrap: "No Wrap"
case .wrap: "Wrap"
}
}
}
Expand Down
Loading

0 comments on commit c94d67b

Please sign in to comment.