diff --git a/Examples/Timecode Math/README.md b/Examples/Timecode Math/README.md new file mode 100644 index 00000000..8cf6ffe0 --- /dev/null +++ b/Examples/Timecode Math/README.md @@ -0,0 +1,11 @@ +# Timecode Math Example + +This example project demonstrates performing math operations with timecode. + +## Platforms + +This project can run on: + +- macOS +- iOS +- visionOS diff --git a/Examples/Timecode Math/Timecode Math.xcodeproj/project.pbxproj b/Examples/Timecode Math/Timecode Math.xcodeproj/project.pbxproj new file mode 100644 index 00000000..08315780 --- /dev/null +++ b/Examples/Timecode Math/Timecode Math.xcodeproj/project.pbxproj @@ -0,0 +1,374 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + E21287892CBC839400C6AB7D /* TimecodeKit in Frameworks */ = {isa = PBXBuildFile; productRef = E21287882CBC839400C6AB7D /* TimecodeKit */; }; + E212878B2CBC839400C6AB7D /* TimecodeKitUI in Frameworks */ = {isa = PBXBuildFile; productRef = E212878A2CBC839400C6AB7D /* TimecodeKitUI */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E263C4D52CBC805D003233F6 /* TimecodeMath.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TimecodeMath.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + E263C4D72CBC805D003233F6 /* Timecode Math */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = "Timecode Math"; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + E263C4D22CBC805D003233F6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E21287892CBC839400C6AB7D /* TimecodeKit in Frameworks */, + E212878B2CBC839400C6AB7D /* TimecodeKitUI in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E263C4CC2CBC805D003233F6 = { + isa = PBXGroup; + children = ( + E263C4D72CBC805D003233F6 /* Timecode Math */, + E263C4D62CBC805D003233F6 /* Products */, + ); + sourceTree = ""; + }; + E263C4D62CBC805D003233F6 /* Products */ = { + isa = PBXGroup; + children = ( + E263C4D52CBC805D003233F6 /* TimecodeMath.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E263C4D42CBC805D003233F6 /* TimecodeMath */ = { + isa = PBXNativeTarget; + buildConfigurationList = E263C4E42CBC805E003233F6 /* Build configuration list for PBXNativeTarget "TimecodeMath" */; + buildPhases = ( + E263C4D12CBC805D003233F6 /* Sources */, + E263C4D22CBC805D003233F6 /* Frameworks */, + E263C4D32CBC805D003233F6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + E263C4D72CBC805D003233F6 /* Timecode Math */, + ); + name = TimecodeMath; + packageProductDependencies = ( + E21287882CBC839400C6AB7D /* TimecodeKit */, + E212878A2CBC839400C6AB7D /* TimecodeKitUI */, + ); + productName = TimecodeMath; + productReference = E263C4D52CBC805D003233F6 /* TimecodeMath.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E263C4CD2CBC805D003233F6 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1600; + LastUpgradeCheck = 1600; + TargetAttributes = { + E263C4D42CBC805D003233F6 = { + CreatedOnToolsVersion = 16.0; + }; + }; + }; + buildConfigurationList = E263C4D02CBC805D003233F6 /* Build configuration list for PBXProject "Timecode Math" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E263C4CC2CBC805D003233F6; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + E21287872CBC839400C6AB7D /* XCLocalSwiftPackageReference "../../../TimecodeKit" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = E263C4D62CBC805D003233F6 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E263C4D42CBC805D003233F6 /* TimecodeMath */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E263C4D32CBC805D003233F6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E263C4D12CBC805D003233F6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + E263C4E22CBC805E003233F6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + E263C4E32CBC805E003233F6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + E263C4E52CBC805E003233F6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = "Timecode Math/App/TimecodeMath.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ""; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = "Timecode Math"; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.video"; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 15.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.orchetect.TimecodeKit.TimecodeMath${DEVELOPMENT_TEAM}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + E263C4E62CBC805E003233F6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = "Timecode Math/App/TimecodeMath.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ""; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = "Timecode Math"; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.video"; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 15.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.orchetect.TimecodeKit.TimecodeMath${DEVELOPMENT_TEAM}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E263C4D02CBC805D003233F6 /* Build configuration list for PBXProject "Timecode Math" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E263C4E22CBC805E003233F6 /* Debug */, + E263C4E32CBC805E003233F6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E263C4E42CBC805E003233F6 /* Build configuration list for PBXNativeTarget "TimecodeMath" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E263C4E52CBC805E003233F6 /* Debug */, + E263C4E62CBC805E003233F6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + E21287872CBC839400C6AB7D /* XCLocalSwiftPackageReference "../../../TimecodeKit" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ../../../TimecodeKit; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + E21287882CBC839400C6AB7D /* TimecodeKit */ = { + isa = XCSwiftPackageProductDependency; + productName = TimecodeKit; + }; + E212878A2CBC839400C6AB7D /* TimecodeKitUI */ = { + isa = XCSwiftPackageProductDependency; + productName = TimecodeKitUI; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = E263C4CD2CBC805D003233F6 /* Project object */; +} diff --git a/Examples/Timecode Math/Timecode Math.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Examples/Timecode Math/Timecode Math.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/Examples/Timecode Math/Timecode Math.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AccentColor.colorset/Contents.json b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..9310b46d --- /dev/null +++ b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,18 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "universal", + "reference" : "systemGreenColor" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "localizable" : true + } +} diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/AppStoreIcon.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/AppStoreIcon.png new file mode 100644 index 00000000..7737ce8f Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/AppStoreIcon.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Contents.json b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..fe06bec8 --- /dev/null +++ b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,176 @@ +{ + "images" : [ + { + "filename" : "IconSmall-20@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "IconSmall-20@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "filename" : "IconSmall@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "IconSmall@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "filename" : "IconSmall-40@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "IconSmall-40@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "filename" : "Icon@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "Icon@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "IconSmall-20.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "IconSmall-20-iPad@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "IconSmall.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "IconSmall-iPad@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "IconSmall-40.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "filename" : "IconSmall-40-iPad@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-76.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "Icon-76@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "Icon-83.5@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "AppStoreIcon.png", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "filename" : "icon_16x16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "icon_16x16@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "icon_32x32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "icon_32x32@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "icon_128x128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "icon_128x128@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "icon_256x256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "icon_256x256@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "icon_512x512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "icon_512x512@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-76.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-76.png new file mode 100644 index 00000000..ef92fd26 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png new file mode 100644 index 00000000..ae30b9e3 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png new file mode 100644 index 00000000..11ea4b2e Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon@2x.png new file mode 100644 index 00000000..e9e40e61 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon@3x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon@3x.png new file mode 100644 index 00000000..48f479bb Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/Icon@3x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20-iPad@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20-iPad@2x.png new file mode 100644 index 00000000..a03b2416 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20-iPad@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20.png new file mode 100644 index 00000000..d6529c33 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20@2x.png new file mode 100644 index 00000000..a03b2416 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20@3x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20@3x.png new file mode 100644 index 00000000..45d40212 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-20@3x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40-iPad@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40-iPad@2x.png new file mode 100644 index 00000000..5b82d9f5 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40-iPad@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40.png new file mode 100644 index 00000000..a03b2416 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40@2x.png new file mode 100644 index 00000000..5b82d9f5 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40@3x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40@3x.png new file mode 100644 index 00000000..e9e40e61 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-40@3x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-iPad@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-iPad@2x.png new file mode 100644 index 00000000..4c561b6d Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall-iPad@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall.png new file mode 100644 index 00000000..3be761a0 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall@2x.png new file mode 100644 index 00000000..4c561b6d Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall@3x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall@3x.png new file mode 100644 index 00000000..55e4843d Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/IconSmall@3x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_128x128.png new file mode 100644 index 00000000..228d55dc Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png new file mode 100644 index 00000000..05e0a98a Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_16x16.png new file mode 100644 index 00000000..e06b41cf Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png new file mode 100644 index 00000000..3567c79b Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_256x256.png new file mode 100644 index 00000000..05e0a98a Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png new file mode 100644 index 00000000..4690f7b0 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_32x32.png new file mode 100644 index 00000000..3567c79b Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png new file mode 100644 index 00000000..3f84dd95 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_512x512.png new file mode 100644 index 00000000..4690f7b0 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png new file mode 100644 index 00000000..bf898292 Binary files /dev/null and b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/Contents.json b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Examples/Timecode Math/Timecode Math/App/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Timecode Math/Timecode Math/App/TimecodeMath.entitlements b/Examples/Timecode Math/Timecode Math/App/TimecodeMath.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/Examples/Timecode Math/Timecode Math/App/TimecodeMath.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Examples/Timecode Math/Timecode Math/App/TimecodeMathApp.swift b/Examples/Timecode Math/Timecode Math/App/TimecodeMathApp.swift new file mode 100644 index 00000000..7d7195ec --- /dev/null +++ b/Examples/Timecode Math/Timecode Math/App/TimecodeMathApp.swift @@ -0,0 +1,30 @@ +// +// TimecodeMathApp.swift +// TimecodeKit • https://github.com/orchetect/TimecodeKit +// © 2020-2024 Steffan Andrews • Licensed under MIT License +// + +import SwiftUI + +@main +struct TimecodeMathApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + .windowModifiersForMacOS() + } +} + +extension Scene { + func windowModifiersForMacOS() -> some Scene { + #if os(macOS) + self + .defaultSize(width: 360, height: 530) + .windowResizability(.contentSize) + .defaultPosition(.center) + #else + self + #endif + } +} diff --git a/Examples/Timecode Math/Timecode Math/ContentView.swift b/Examples/Timecode Math/Timecode Math/ContentView.swift new file mode 100644 index 00000000..3f3769e2 --- /dev/null +++ b/Examples/Timecode Math/Timecode Math/ContentView.swift @@ -0,0 +1,225 @@ +// +// ContentView.swift +// TimecodeKit • https://github.com/orchetect/TimecodeKit +// © 2020-2024 Steffan Andrews • Licensed under MIT License +// + +import SwiftUI +import TimecodeKit +import TimecodeKitUI + +struct ContentView: View { + @State private var frameRate: TimecodeFrameRate = .fps24 + + var body: some View { + VStack(spacing: 20) { + Form { + Picker("Frame Rate", selection: $frameRate) { + ForEach(TimecodeFrameRate.allCases) { rate in + Text(rate.stringValueVerbose).id(rate) + } + } + + ExpressionsView(frameRate: frameRate).id(frameRate) + } + .formStyle(.grouped) + } + .padding() + } +} + +struct ExpressionsView: View { + let frameRate: TimecodeFrameRate + + var body: some View { + Group { + TimecodeMathExpressionView( + operation: .add, + lhs: Timecode(.components(h: 1), at: frameRate, by: .allowingInvalid), + rhs: Timecode(.components(m: 20), at: frameRate, by: .allowingInvalid) + ) + + TimecodeMathExpressionView( + operation: .subtract, + lhs: Timecode(.components(h: 1), at: frameRate, by: .allowingInvalid), + rhs: Timecode(.components(m: 20), at: frameRate, by: .allowingInvalid) + ) + + DoubleMathExpressionView( + operation: .multiply, + lhs: Timecode(.components(h: 1), at: frameRate, by: .allowingInvalid), + rhs: 2.5 + ) + + DoubleMathExpressionView( + operation: .divide, + lhs: Timecode(.components(h: 1), at: frameRate, by: .allowingInvalid), + rhs: 2.5 + ) + } + .font(.title3) + .foregroundStyle(.primary) + .timecodeFormat([.showSubFrames]) + .timecodeSeparatorStyle(.secondary) + .timecodeValidationStyle(.red) + .timecodeFieldInputStyle(.autoAdvance) + .timecodeFieldInputWrapping(.noWrap) + } +} + +struct TimecodeMathExpressionView: View { + var operation: MathOperation + @TimecodeState var lhs: Timecode + @TimecodeState var rhs: Timecode + + @TimecodeState private var result: Timecode + + init(operation: MathOperation, lhs: Timecode, rhs: Timecode) { + self.operation = operation + self.lhs = lhs + self.rhs = rhs + self.result = operation.result(lhs: lhs, rhs: rhs) + } + + var body: some View { + LabeledContent("") { + Grid(alignment: .trailing) { + GridRow { + Color.clear + .gridCellUnsizedAxes([.horizontal, .vertical]) + TimecodeField(timecode: $lhs) + } + GridRow { + operation.image + TimecodeField(timecode: $rhs) + } + GridRow { + Rectangle().fill(.primary).frame(height: 2) + .gridCellColumns(2) + .gridCellUnsizedAxes([.horizontal, .vertical]) + } + GridRow { + Color.clear + .gridCellUnsizedAxes([.horizontal, .vertical]) + TimecodeText(result) + .foregroundStyle(.accent) + } + } + } + + .onChange(of: [rhs, lhs], initial: true) { _, _ in + result = operation.result(lhs: lhs, rhs: rhs) + } + } + + enum MathOperation { + case add + case subtract + + var image: Image { + switch self { + case .add: + Image(systemName: "plus") + case .subtract: + Image(systemName: "minus") + } + } + + func result(lhs: Timecode, rhs: Timecode) -> Timecode { + switch self { + case .add: + return lhs + rhs + case .subtract: + return lhs - rhs + } + } + } +} + +struct DoubleMathExpressionView: View { + var operation: MathOperation + @TimecodeState var lhs: Timecode + @State var rhs: Double + + @TimecodeState private var result: Timecode + + init(operation: MathOperation, lhs: Timecode, rhs: Double) { + self.operation = operation + self.rhs = rhs + self.lhs = lhs + self.result = operation.result(lhs: lhs, rhs: rhs) + } + + var body: some View { + LabeledContent("") { + Grid(alignment: .trailing) { + GridRow { + Color.clear + .gridCellUnsizedAxes([.horizontal, .vertical]) + TimecodeField(timecode: $lhs) + } + GridRow { + operation.image + TextField("Value", value: $rhs, format: .number.precision(.fractionLength(2))) + #if !os(macOS) + .keyboardType(.decimalPad) + #endif + .labelsHidden() + } + GridRow { + Rectangle().fill(.primary).frame(height: 2) + .gridCellColumns(2) + .gridCellUnsizedAxes([.horizontal, .vertical]) + } + GridRow { + Color.clear + .gridCellUnsizedAxes([.horizontal, .vertical]) + TimecodeText(result) + .foregroundStyle(.accent) + } + } + } + + .onChange(of: rhs, initial: true) { _, _ in + result = operation.result(lhs: lhs, rhs: rhs) + } + .onChange(of: lhs, initial: true) { _, _ in + result = operation.result(lhs: lhs, rhs: rhs) + } + } + + enum MathOperation { + case multiply + case divide + + var image: Image { + switch self { + case .multiply: + Image(systemName: "multiply") + case .divide: + Image(systemName: "divide") + } + } + + func result(lhs: Timecode, rhs: Double) -> Timecode { + switch self { + case .multiply: + return lhs * rhs + case .divide: + guard !rhs.isZero else { return Timecode(.zero, using: lhs.properties) } + return lhs / rhs + } + } + } +} + +extension Image { + func sizeForOperation() -> some View { + self.resizable() + .frame(width: 30, height: 30) + } +} + +#Preview { + ContentView() +}