├── .gitignore ├── Assets.xcassets ├── AccentColor.colorset │ └── Contents.json ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── ContentView.swift ├── Info.plist ├── README.md ├── ReplicateExample.entitlements ├── ReplicateExample.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── swiftpm │ └── Package.resolved └── ReplicateExampleApp.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## App packaging 9 | *.ipa 10 | *.dSYM.zip 11 | *.dSYM 12 | 13 | ## Playgrounds 14 | timeline.xctimeline 15 | playground.xcworkspace 16 | 17 | # Swift Package Manager 18 | # 19 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 20 | # Packages/ 21 | # Package.pins 22 | # Package.resolved 23 | # *.xcodeproj 24 | # 25 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 26 | # hence it is not needed unless you have added a package configuration file to your project 27 | # .swiftpm 28 | 29 | .build/ 30 | -------------------------------------------------------------------------------- /Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "1x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "2x", 16 | "size" : "16x16" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "1x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "2x", 26 | "size" : "32x32" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "1x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "2x", 36 | "size" : "128x128" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "1x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "2x", 46 | "size" : "256x256" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "1x", 51 | "size" : "512x512" 52 | }, 53 | { 54 | "idiom" : "mac", 55 | "scale" : "2x", 56 | "size" : "512x512" 57 | } 58 | ], 59 | "info" : { 60 | "author" : "xcode", 61 | "version" : 1 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ContentView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import Replicate 3 | 4 | // Get your API token at https://replicate.com/account 5 | private let client = Replicate.Client(token: <#token#>) 6 | #warning( 7 | """ 8 | Don't put secrets in code or any other resources bundled with your app. 9 | Instead, fetch them from CloudKit or another server and store them in the keychain. 10 | 11 | See: 12 | • https://developer.apple.com/documentation/cloudkit/ckdatabase/1449126-fetch 13 | • https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_keychain 14 | """ 15 | ) 16 | 17 | // https://replicate.com/stability-ai/stable-diffusion 18 | enum StableDiffusion: Predictable { 19 | static var modelID = "stability-ai/stable-diffusion" 20 | static let versionID = "db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf" 21 | 22 | struct Input: Codable { 23 | let prompt: String 24 | } 25 | 26 | typealias Output = [URL] 27 | } 28 | 29 | struct ContentView: View { 30 | @State private var prompt = "" 31 | @State private var prediction: StableDiffusion.Prediction? = nil 32 | 33 | var body: some View { 34 | Form { 35 | Section { 36 | TextField(text: $prompt, 37 | prompt: Text("Enter a prompt to display an image"), 38 | axis: .vertical, 39 | label: {}) 40 | .disabled(prediction?.status.terminated == false) 41 | .submitLabel(.go) 42 | .onSubmit(of: .text) { 43 | Task { 44 | try! await generate() 45 | } 46 | } 47 | } 48 | 49 | if let prediction { 50 | ZStack { 51 | Color.clear 52 | .aspectRatio(1.0, contentMode: .fit) 53 | 54 | switch prediction.status { 55 | case .starting, .processing: 56 | VStack{ 57 | ProgressView("Generating...") 58 | .padding(32) 59 | 60 | Button("Cancel") { 61 | Task { try await cancel() } 62 | } 63 | } 64 | case .failed: 65 | Text(prediction.error?.localizedDescription ?? "Unknown error") 66 | .foregroundColor(.red) 67 | case .succeeded: 68 | if let url = prediction.output?.first { 69 | VStack { 70 | AsyncImage(url: url, scale: 2.0, content: { phase in 71 | phase.image? 72 | .resizable() 73 | .aspectRatio(contentMode: .fit) 74 | .cornerRadius(32) 75 | }) 76 | 77 | ShareLink("Export", item: url) 78 | .padding(32) 79 | 80 | } 81 | } 82 | case .canceled: 83 | Text("The prediction was canceled") 84 | .foregroundColor(.secondary) 85 | } 86 | } 87 | .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) 88 | .padding() 89 | .listRowBackground(Color.clear) 90 | .listRowInsets(.init()) 91 | } 92 | } 93 | 94 | Spacer() 95 | } 96 | 97 | func generate() async throws { 98 | prediction = try await StableDiffusion.predict(with: client, 99 | input: .init(prompt: prompt)) 100 | try await prediction?.wait(with: client) 101 | } 102 | 103 | func cancel() async throws { 104 | try await prediction?.cancel(with: client) 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Getting started with SwiftUI and Replicate 2 | 3 | This is a [SwiftUI](https://developer.apple.com/xcode/swiftui/) template project for working with Replicate's API. 4 | 5 | You can use this as a quick jumping-off point to build an app using Replicate's API, or you can recreate this codebase from scratch by following the guide at [replicate.com/docs/get-started/swiftui](https://replicate.com/docs/get-started/swiftui) 6 | 7 | ## Noteworthy files 8 | 9 | - [ContentView.swift](ContentView.swift) - The main content view of the app, including the Replicate API client 10 | 11 | ## Usage 12 | 13 | Open with Xcode 14 | 15 | ```console 16 | xed . 17 | ``` 18 | 19 | Provide your [Replicate API token](https://replicate.com/account#token) 20 | 21 | ``` 22 | private var client = Replicate.Client(token: <#token#>) 23 | ``` 24 | 25 | > **Warning** 26 | > 27 | > Don't store secrets in code or any other resources bundled with your app. 28 | > Instead, fetch them from CloudKit or another server and store them in the keychain. 29 | > 30 | > See: 31 | > 32 | > - [`fetch(withRecordID:completionHandler:)` reference](https://developer.apple.com/documentation/cloudkit/ckdatabase/1449126-fetch) 33 | > - ["Storing Keys in the Keychain"](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_keychain) 34 | 35 | In Xcode, go to the "Product" menu and select "Run" (R) 36 | 37 | For detailed instructions on how to create and use this template, see [replicate.com/docs/get-started/swiftui](https://replicate.com/docs/get-started/swiftui) 38 | 39 | ![Example image generated with prompt "renaissance portrait of a figure holding an iPhone"](https://user-images.githubusercontent.com/7659/227384901-5bae4745-8e82-4fa9-aa40-ddd3b968adf5.png) 40 | -------------------------------------------------------------------------------- /ReplicateExample.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | com.apple.security.network.client 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ReplicateExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F8D0EFBD2A0979EF004F22EF /* Replicate in Frameworks */ = {isa = PBXBuildFile; productRef = F8D0EFBC2A0979EF004F22EF /* Replicate */; }; 11 | F8E9F19D29CB7F0F00911811 /* ReplicateExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E9F19C29CB7F0F00911811 /* ReplicateExampleApp.swift */; }; 12 | F8E9F19F29CB7F0F00911811 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E9F19E29CB7F0F00911811 /* ContentView.swift */; }; 13 | F8E9F1A129CB7F1000911811 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8E9F1A029CB7F1000911811 /* Assets.xcassets */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | F8E9F19929CB7F0F00911811 /* ReplicateExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReplicateExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | F8E9F19C29CB7F0F00911811 /* ReplicateExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplicateExampleApp.swift; sourceTree = ""; }; 19 | F8E9F19E29CB7F0F00911811 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 20 | F8E9F1A029CB7F1000911811 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 21 | F8E9F1A229CB7F1000911811 /* ReplicateExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ReplicateExample.entitlements; sourceTree = ""; }; 22 | /* End PBXFileReference section */ 23 | 24 | /* Begin PBXFrameworksBuildPhase section */ 25 | F8E9F19629CB7F0F00911811 /* Frameworks */ = { 26 | isa = PBXFrameworksBuildPhase; 27 | buildActionMask = 2147483647; 28 | files = ( 29 | F8D0EFBD2A0979EF004F22EF /* Replicate in Frameworks */, 30 | ); 31 | runOnlyForDeploymentPostprocessing = 0; 32 | }; 33 | /* End PBXFrameworksBuildPhase section */ 34 | 35 | /* Begin PBXGroup section */ 36 | F8E9F19029CB7F0F00911811 = { 37 | isa = PBXGroup; 38 | children = ( 39 | F8E9F19C29CB7F0F00911811 /* ReplicateExampleApp.swift */, 40 | F8E9F19E29CB7F0F00911811 /* ContentView.swift */, 41 | F8E9F1A029CB7F1000911811 /* Assets.xcassets */, 42 | F8E9F1A229CB7F1000911811 /* ReplicateExample.entitlements */, 43 | F8E9F19A29CB7F0F00911811 /* Products */, 44 | ); 45 | sourceTree = ""; 46 | }; 47 | F8E9F19A29CB7F0F00911811 /* Products */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | F8E9F19929CB7F0F00911811 /* ReplicateExample.app */, 51 | ); 52 | name = Products; 53 | sourceTree = ""; 54 | }; 55 | /* End PBXGroup section */ 56 | 57 | /* Begin PBXNativeTarget section */ 58 | F8E9F19829CB7F0F00911811 /* ReplicateExample */ = { 59 | isa = PBXNativeTarget; 60 | buildConfigurationList = F8E9F1A829CB7F1000911811 /* Build configuration list for PBXNativeTarget "ReplicateExample" */; 61 | buildPhases = ( 62 | F8E9F19529CB7F0F00911811 /* Sources */, 63 | F8E9F19629CB7F0F00911811 /* Frameworks */, 64 | F8E9F19729CB7F0F00911811 /* Resources */, 65 | ); 66 | buildRules = ( 67 | ); 68 | dependencies = ( 69 | ); 70 | name = ReplicateExample; 71 | packageProductDependencies = ( 72 | F8D0EFBC2A0979EF004F22EF /* Replicate */, 73 | ); 74 | productName = ReplicateExample; 75 | productReference = F8E9F19929CB7F0F00911811 /* ReplicateExample.app */; 76 | productType = "com.apple.product-type.application"; 77 | }; 78 | /* End PBXNativeTarget section */ 79 | 80 | /* Begin PBXProject section */ 81 | F8E9F19129CB7F0F00911811 /* Project object */ = { 82 | isa = PBXProject; 83 | attributes = { 84 | BuildIndependentTargetsInParallel = 1; 85 | LastSwiftUpdateCheck = 1420; 86 | LastUpgradeCheck = 1420; 87 | TargetAttributes = { 88 | F8E9F19829CB7F0F00911811 = { 89 | CreatedOnToolsVersion = 14.2; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = F8E9F19429CB7F0F00911811 /* Build configuration list for PBXProject "ReplicateExample" */; 94 | compatibilityVersion = "Xcode 14.0"; 95 | developmentRegion = en; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | Base, 100 | ); 101 | mainGroup = F8E9F19029CB7F0F00911811; 102 | packageReferences = ( 103 | F8D0EFBB2A0979EF004F22EF /* XCRemoteSwiftPackageReference "replicate-swift" */, 104 | ); 105 | productRefGroup = F8E9F19A29CB7F0F00911811 /* Products */; 106 | projectDirPath = ""; 107 | projectRoot = ""; 108 | targets = ( 109 | F8E9F19829CB7F0F00911811 /* ReplicateExample */, 110 | ); 111 | }; 112 | /* End PBXProject section */ 113 | 114 | /* Begin PBXResourcesBuildPhase section */ 115 | F8E9F19729CB7F0F00911811 /* Resources */ = { 116 | isa = PBXResourcesBuildPhase; 117 | buildActionMask = 2147483647; 118 | files = ( 119 | F8E9F1A129CB7F1000911811 /* Assets.xcassets in Resources */, 120 | ); 121 | runOnlyForDeploymentPostprocessing = 0; 122 | }; 123 | /* End PBXResourcesBuildPhase section */ 124 | 125 | /* Begin PBXSourcesBuildPhase section */ 126 | F8E9F19529CB7F0F00911811 /* Sources */ = { 127 | isa = PBXSourcesBuildPhase; 128 | buildActionMask = 2147483647; 129 | files = ( 130 | F8E9F19F29CB7F0F00911811 /* ContentView.swift in Sources */, 131 | F8E9F19D29CB7F0F00911811 /* ReplicateExampleApp.swift in Sources */, 132 | ); 133 | runOnlyForDeploymentPostprocessing = 0; 134 | }; 135 | /* End PBXSourcesBuildPhase section */ 136 | 137 | /* Begin XCBuildConfiguration section */ 138 | F8E9F1A629CB7F1000911811 /* Debug */ = { 139 | isa = XCBuildConfiguration; 140 | buildSettings = { 141 | ALWAYS_SEARCH_USER_PATHS = NO; 142 | CLANG_ANALYZER_NONNULL = YES; 143 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 144 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 145 | CLANG_ENABLE_MODULES = YES; 146 | CLANG_ENABLE_OBJC_ARC = YES; 147 | CLANG_ENABLE_OBJC_WEAK = YES; 148 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 149 | CLANG_WARN_BOOL_CONVERSION = YES; 150 | CLANG_WARN_COMMA = YES; 151 | CLANG_WARN_CONSTANT_CONVERSION = YES; 152 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 153 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 154 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 155 | CLANG_WARN_EMPTY_BODY = YES; 156 | CLANG_WARN_ENUM_CONVERSION = YES; 157 | CLANG_WARN_INFINITE_RECURSION = YES; 158 | CLANG_WARN_INT_CONVERSION = YES; 159 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 160 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 161 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 162 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 163 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 164 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 165 | CLANG_WARN_STRICT_PROTOTYPES = YES; 166 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 167 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 168 | CLANG_WARN_UNREACHABLE_CODE = YES; 169 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 170 | COPY_PHASE_STRIP = NO; 171 | DEBUG_INFORMATION_FORMAT = dwarf; 172 | ENABLE_STRICT_OBJC_MSGSEND = YES; 173 | ENABLE_TESTABILITY = YES; 174 | GCC_C_LANGUAGE_STANDARD = gnu11; 175 | GCC_DYNAMIC_NO_PIC = NO; 176 | GCC_NO_COMMON_BLOCKS = YES; 177 | GCC_OPTIMIZATION_LEVEL = 0; 178 | GCC_PREPROCESSOR_DEFINITIONS = ( 179 | "DEBUG=1", 180 | "$(inherited)", 181 | ); 182 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 183 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 184 | GCC_WARN_UNDECLARED_SELECTOR = YES; 185 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 186 | GCC_WARN_UNUSED_FUNCTION = YES; 187 | GCC_WARN_UNUSED_VARIABLE = YES; 188 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 189 | MTL_FAST_MATH = YES; 190 | ONLY_ACTIVE_ARCH = YES; 191 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 192 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 193 | }; 194 | name = Debug; 195 | }; 196 | F8E9F1A729CB7F1000911811 /* Release */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_ANALYZER_NONNULL = YES; 201 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 202 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 203 | CLANG_ENABLE_MODULES = YES; 204 | CLANG_ENABLE_OBJC_ARC = YES; 205 | CLANG_ENABLE_OBJC_WEAK = YES; 206 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 207 | CLANG_WARN_BOOL_CONVERSION = YES; 208 | CLANG_WARN_COMMA = YES; 209 | CLANG_WARN_CONSTANT_CONVERSION = YES; 210 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 211 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 212 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 213 | CLANG_WARN_EMPTY_BODY = YES; 214 | CLANG_WARN_ENUM_CONVERSION = YES; 215 | CLANG_WARN_INFINITE_RECURSION = YES; 216 | CLANG_WARN_INT_CONVERSION = YES; 217 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 218 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 219 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 221 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 222 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 223 | CLANG_WARN_STRICT_PROTOTYPES = YES; 224 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 225 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 226 | CLANG_WARN_UNREACHABLE_CODE = YES; 227 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 228 | COPY_PHASE_STRIP = NO; 229 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 230 | ENABLE_NS_ASSERTIONS = NO; 231 | ENABLE_STRICT_OBJC_MSGSEND = YES; 232 | GCC_C_LANGUAGE_STANDARD = gnu11; 233 | GCC_NO_COMMON_BLOCKS = YES; 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | MTL_ENABLE_DEBUG_INFO = NO; 241 | MTL_FAST_MATH = YES; 242 | SWIFT_COMPILATION_MODE = wholemodule; 243 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 244 | }; 245 | name = Release; 246 | }; 247 | F8E9F1A929CB7F1000911811 /* Debug */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 251 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 252 | CODE_SIGN_ENTITLEMENTS = ReplicateExample.entitlements; 253 | CODE_SIGN_STYLE = Automatic; 254 | CURRENT_PROJECT_VERSION = 1; 255 | ENABLE_PREVIEWS = YES; 256 | GENERATE_INFOPLIST_FILE = YES; 257 | INFOPLIST_FILE = Info.plist; 258 | "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; 259 | "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; 260 | "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; 261 | "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; 262 | "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; 263 | "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; 264 | "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; 265 | "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; 266 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 267 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 268 | IPHONEOS_DEPLOYMENT_TARGET = 16.2; 269 | LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; 270 | "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; 271 | MACOSX_DEPLOYMENT_TARGET = 13.1; 272 | MARKETING_VERSION = 1.0; 273 | PRODUCT_BUNDLE_IDENTIFIER = com.myorg.ReplicateExample; 274 | PRODUCT_NAME = "$(TARGET_NAME)"; 275 | SDKROOT = auto; 276 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; 277 | SWIFT_EMIT_LOC_STRINGS = YES; 278 | SWIFT_VERSION = 5.0; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | }; 281 | name = Debug; 282 | }; 283 | F8E9F1AA29CB7F1000911811 /* Release */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 288 | CODE_SIGN_ENTITLEMENTS = ReplicateExample.entitlements; 289 | CODE_SIGN_STYLE = Automatic; 290 | CURRENT_PROJECT_VERSION = 1; 291 | ENABLE_PREVIEWS = YES; 292 | GENERATE_INFOPLIST_FILE = YES; 293 | INFOPLIST_FILE = Info.plist; 294 | "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; 295 | "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; 296 | "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; 297 | "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; 298 | "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; 299 | "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; 300 | "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; 301 | "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; 302 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 303 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 304 | IPHONEOS_DEPLOYMENT_TARGET = 16.2; 305 | LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; 306 | "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; 307 | MACOSX_DEPLOYMENT_TARGET = 13.1; 308 | MARKETING_VERSION = 1.0; 309 | PRODUCT_BUNDLE_IDENTIFIER = com.myorg.ReplicateExample; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | SDKROOT = auto; 312 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; 313 | SWIFT_EMIT_LOC_STRINGS = YES; 314 | SWIFT_VERSION = 5.0; 315 | TARGETED_DEVICE_FAMILY = "1,2"; 316 | }; 317 | name = Release; 318 | }; 319 | /* End XCBuildConfiguration section */ 320 | 321 | /* Begin XCConfigurationList section */ 322 | F8E9F19429CB7F0F00911811 /* Build configuration list for PBXProject "ReplicateExample" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | F8E9F1A629CB7F1000911811 /* Debug */, 326 | F8E9F1A729CB7F1000911811 /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | F8E9F1A829CB7F1000911811 /* Build configuration list for PBXNativeTarget "ReplicateExample" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | F8E9F1A929CB7F1000911811 /* Debug */, 335 | F8E9F1AA29CB7F1000911811 /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | /* End XCConfigurationList section */ 341 | 342 | /* Begin XCRemoteSwiftPackageReference section */ 343 | F8D0EFBB2A0979EF004F22EF /* XCRemoteSwiftPackageReference "replicate-swift" */ = { 344 | isa = XCRemoteSwiftPackageReference; 345 | repositoryURL = "https://github.com/replicate/replicate-swift"; 346 | requirement = { 347 | kind = upToNextMajorVersion; 348 | minimumVersion = 0.12.1; 349 | }; 350 | }; 351 | /* End XCRemoteSwiftPackageReference section */ 352 | 353 | /* Begin XCSwiftPackageProductDependency section */ 354 | F8D0EFBC2A0979EF004F22EF /* Replicate */ = { 355 | isa = XCSwiftPackageProductDependency; 356 | package = F8D0EFBB2A0979EF004F22EF /* XCRemoteSwiftPackageReference "replicate-swift" */; 357 | productName = Replicate; 358 | }; 359 | /* End XCSwiftPackageProductDependency section */ 360 | }; 361 | rootObject = F8E9F19129CB7F0F00911811 /* Project object */; 362 | } 363 | -------------------------------------------------------------------------------- /ReplicateExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ReplicateExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ReplicateExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "replicate-swift", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/replicate/replicate-swift", 7 | "state" : { 8 | "revision" : "30cb372ed40e69591f1beda443f46264fd09765e", 9 | "version" : "0.12.1" 10 | } 11 | } 12 | ], 13 | "version" : 2 14 | } 15 | -------------------------------------------------------------------------------- /ReplicateExampleApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | @main 4 | struct ReplicateExampleApp: App { 5 | var body: some Scene { 6 | #if os(macOS) 7 | WindowGroup { 8 | ContentView().frame(minWidth: 512, minHeight: 512).padding() 9 | }.windowStyle(.hiddenTitleBar) 10 | #else 11 | WindowGroup { 12 | ContentView() 13 | } 14 | #endif 15 | } 16 | } 17 | --------------------------------------------------------------------------------