├── README.md ├── SwiftUI Chat.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── halvini.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── SwiftUI Chat ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── ChatController.swift ├── ContentView.swift ├── Info.plist ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json └── SceneDelegate.swift ├── SwiftUI ChatTests ├── Info.plist └── SwiftUI_ChatTests.swift └── SwiftUI ChatUITests ├── Info.plist └── SwiftUI_ChatUITests.swift /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUI-Chat 2 | The world's first open-source chat app in SwiftUI. Written right during the Apple WWDC2019 Event, when SwiftUI was presented to the global iOS developers community in Beta. Your improvements to the repository are welcome 3 | 4 | **Updated on Oct 11, 2019! The code supports the latest macOS Catalina, iOS 13, and XCode available to this date** 5 | 6 | Read the full documentary here: 7 | 8 | **How to build a Chat App or Messenger in SwiftUI for iOS Swift:** 9 | https://medium.com/@halavins/how-to-build-a-chat-app-or-messenger-in-swiftui-for-ios-swift-b46dbe5cc0ab 10 | -------------------------------------------------------------------------------- /SwiftUI Chat.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3954C66D22AB3D10009BB210 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3954C66C22AB3D10009BB210 /* AppDelegate.swift */; }; 11 | 3954C66F22AB3D10009BB210 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3954C66E22AB3D10009BB210 /* SceneDelegate.swift */; }; 12 | 3954C67122AB3D10009BB210 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3954C67022AB3D10009BB210 /* ContentView.swift */; }; 13 | 3954C67322AB3D12009BB210 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3954C67222AB3D12009BB210 /* Assets.xcassets */; }; 14 | 3954C67622AB3D12009BB210 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3954C67522AB3D12009BB210 /* Preview Assets.xcassets */; }; 15 | 3954C67922AB3D12009BB210 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3954C67722AB3D12009BB210 /* LaunchScreen.storyboard */; }; 16 | 3954C68422AB3D12009BB210 /* SwiftUI_ChatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3954C68322AB3D12009BB210 /* SwiftUI_ChatTests.swift */; }; 17 | 3954C68F22AB3D12009BB210 /* SwiftUI_ChatUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3954C68E22AB3D12009BB210 /* SwiftUI_ChatUITests.swift */; }; 18 | 3954C69D22AB51C4009BB210 /* ChatController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3954C69C22AB51C4009BB210 /* ChatController.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 3954C68022AB3D12009BB210 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 3954C66122AB3D10009BB210 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 3954C66822AB3D10009BB210; 27 | remoteInfo = "SwiftUI Chat"; 28 | }; 29 | 3954C68B22AB3D12009BB210 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 3954C66122AB3D10009BB210 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 3954C66822AB3D10009BB210; 34 | remoteInfo = "SwiftUI Chat"; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 3954C66922AB3D10009BB210 /* SwiftUI Chat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftUI Chat.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 3954C66C22AB3D10009BB210 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | 3954C66E22AB3D10009BB210 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 42 | 3954C67022AB3D10009BB210 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 43 | 3954C67222AB3D12009BB210 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | 3954C67522AB3D12009BB210 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 45 | 3954C67822AB3D12009BB210 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 3954C67A22AB3D12009BB210 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | 3954C67F22AB3D12009BB210 /* SwiftUI ChatTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SwiftUI ChatTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 3954C68322AB3D12009BB210 /* SwiftUI_ChatTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUI_ChatTests.swift; sourceTree = ""; }; 49 | 3954C68522AB3D12009BB210 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 3954C68A22AB3D12009BB210 /* SwiftUI ChatUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SwiftUI ChatUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 3954C68E22AB3D12009BB210 /* SwiftUI_ChatUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUI_ChatUITests.swift; sourceTree = ""; }; 52 | 3954C69022AB3D12009BB210 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 3954C69C22AB51C4009BB210 /* ChatController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatController.swift; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 3954C66622AB3D10009BB210 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | 3954C67C22AB3D12009BB210 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 3954C68722AB3D12009BB210 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | 3954C66022AB3D10009BB210 = { 82 | isa = PBXGroup; 83 | children = ( 84 | 3954C66B22AB3D10009BB210 /* SwiftUI Chat */, 85 | 3954C68222AB3D12009BB210 /* SwiftUI ChatTests */, 86 | 3954C68D22AB3D12009BB210 /* SwiftUI ChatUITests */, 87 | 3954C66A22AB3D10009BB210 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 3954C66A22AB3D10009BB210 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 3954C66922AB3D10009BB210 /* SwiftUI Chat.app */, 95 | 3954C67F22AB3D12009BB210 /* SwiftUI ChatTests.xctest */, 96 | 3954C68A22AB3D12009BB210 /* SwiftUI ChatUITests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 3954C66B22AB3D10009BB210 /* SwiftUI Chat */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 3954C66C22AB3D10009BB210 /* AppDelegate.swift */, 105 | 3954C66E22AB3D10009BB210 /* SceneDelegate.swift */, 106 | 3954C67022AB3D10009BB210 /* ContentView.swift */, 107 | 3954C69C22AB51C4009BB210 /* ChatController.swift */, 108 | 3954C67222AB3D12009BB210 /* Assets.xcassets */, 109 | 3954C67722AB3D12009BB210 /* LaunchScreen.storyboard */, 110 | 3954C67A22AB3D12009BB210 /* Info.plist */, 111 | 3954C67422AB3D12009BB210 /* Preview Content */, 112 | ); 113 | path = "SwiftUI Chat"; 114 | sourceTree = ""; 115 | }; 116 | 3954C67422AB3D12009BB210 /* Preview Content */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 3954C67522AB3D12009BB210 /* Preview Assets.xcassets */, 120 | ); 121 | path = "Preview Content"; 122 | sourceTree = ""; 123 | }; 124 | 3954C68222AB3D12009BB210 /* SwiftUI ChatTests */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 3954C68322AB3D12009BB210 /* SwiftUI_ChatTests.swift */, 128 | 3954C68522AB3D12009BB210 /* Info.plist */, 129 | ); 130 | path = "SwiftUI ChatTests"; 131 | sourceTree = ""; 132 | }; 133 | 3954C68D22AB3D12009BB210 /* SwiftUI ChatUITests */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 3954C68E22AB3D12009BB210 /* SwiftUI_ChatUITests.swift */, 137 | 3954C69022AB3D12009BB210 /* Info.plist */, 138 | ); 139 | path = "SwiftUI ChatUITests"; 140 | sourceTree = ""; 141 | }; 142 | /* End PBXGroup section */ 143 | 144 | /* Begin PBXNativeTarget section */ 145 | 3954C66822AB3D10009BB210 /* SwiftUI Chat */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = 3954C69322AB3D12009BB210 /* Build configuration list for PBXNativeTarget "SwiftUI Chat" */; 148 | buildPhases = ( 149 | 3954C66522AB3D10009BB210 /* Sources */, 150 | 3954C66622AB3D10009BB210 /* Frameworks */, 151 | 3954C66722AB3D10009BB210 /* Resources */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | ); 157 | name = "SwiftUI Chat"; 158 | productName = "SwiftUI Chat"; 159 | productReference = 3954C66922AB3D10009BB210 /* SwiftUI Chat.app */; 160 | productType = "com.apple.product-type.application"; 161 | }; 162 | 3954C67E22AB3D12009BB210 /* SwiftUI ChatTests */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = 3954C69622AB3D12009BB210 /* Build configuration list for PBXNativeTarget "SwiftUI ChatTests" */; 165 | buildPhases = ( 166 | 3954C67B22AB3D12009BB210 /* Sources */, 167 | 3954C67C22AB3D12009BB210 /* Frameworks */, 168 | 3954C67D22AB3D12009BB210 /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | 3954C68122AB3D12009BB210 /* PBXTargetDependency */, 174 | ); 175 | name = "SwiftUI ChatTests"; 176 | productName = "SwiftUI ChatTests"; 177 | productReference = 3954C67F22AB3D12009BB210 /* SwiftUI ChatTests.xctest */; 178 | productType = "com.apple.product-type.bundle.unit-test"; 179 | }; 180 | 3954C68922AB3D12009BB210 /* SwiftUI ChatUITests */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = 3954C69922AB3D12009BB210 /* Build configuration list for PBXNativeTarget "SwiftUI ChatUITests" */; 183 | buildPhases = ( 184 | 3954C68622AB3D12009BB210 /* Sources */, 185 | 3954C68722AB3D12009BB210 /* Frameworks */, 186 | 3954C68822AB3D12009BB210 /* Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | 3954C68C22AB3D12009BB210 /* PBXTargetDependency */, 192 | ); 193 | name = "SwiftUI ChatUITests"; 194 | productName = "SwiftUI ChatUITests"; 195 | productReference = 3954C68A22AB3D12009BB210 /* SwiftUI ChatUITests.xctest */; 196 | productType = "com.apple.product-type.bundle.ui-testing"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | 3954C66122AB3D10009BB210 /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastSwiftUpdateCheck = 1100; 205 | LastUpgradeCheck = 1100; 206 | ORGANIZATIONNAME = "AntiChat, Inc."; 207 | TargetAttributes = { 208 | 3954C66822AB3D10009BB210 = { 209 | CreatedOnToolsVersion = 11.0; 210 | }; 211 | 3954C67E22AB3D12009BB210 = { 212 | CreatedOnToolsVersion = 11.0; 213 | TestTargetID = 3954C66822AB3D10009BB210; 214 | }; 215 | 3954C68922AB3D12009BB210 = { 216 | CreatedOnToolsVersion = 11.0; 217 | TestTargetID = 3954C66822AB3D10009BB210; 218 | }; 219 | }; 220 | }; 221 | buildConfigurationList = 3954C66422AB3D10009BB210 /* Build configuration list for PBXProject "SwiftUI Chat" */; 222 | compatibilityVersion = "Xcode 9.3"; 223 | developmentRegion = en; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | Base, 228 | ); 229 | mainGroup = 3954C66022AB3D10009BB210; 230 | productRefGroup = 3954C66A22AB3D10009BB210 /* Products */; 231 | projectDirPath = ""; 232 | projectRoot = ""; 233 | targets = ( 234 | 3954C66822AB3D10009BB210 /* SwiftUI Chat */, 235 | 3954C67E22AB3D12009BB210 /* SwiftUI ChatTests */, 236 | 3954C68922AB3D12009BB210 /* SwiftUI ChatUITests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 3954C66722AB3D10009BB210 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 3954C67922AB3D12009BB210 /* LaunchScreen.storyboard in Resources */, 247 | 3954C67622AB3D12009BB210 /* Preview Assets.xcassets in Resources */, 248 | 3954C67322AB3D12009BB210 /* Assets.xcassets in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | 3954C67D22AB3D12009BB210 /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | 3954C68822AB3D12009BB210 /* Resources */ = { 260 | isa = PBXResourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | /* End PBXResourcesBuildPhase section */ 267 | 268 | /* Begin PBXSourcesBuildPhase section */ 269 | 3954C66522AB3D10009BB210 /* Sources */ = { 270 | isa = PBXSourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | 3954C66D22AB3D10009BB210 /* AppDelegate.swift in Sources */, 274 | 3954C66F22AB3D10009BB210 /* SceneDelegate.swift in Sources */, 275 | 3954C67122AB3D10009BB210 /* ContentView.swift in Sources */, 276 | 3954C69D22AB51C4009BB210 /* ChatController.swift in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | 3954C67B22AB3D12009BB210 /* Sources */ = { 281 | isa = PBXSourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | 3954C68422AB3D12009BB210 /* SwiftUI_ChatTests.swift in Sources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | 3954C68622AB3D12009BB210 /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 3954C68F22AB3D12009BB210 /* SwiftUI_ChatUITests.swift in Sources */, 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | /* End PBXSourcesBuildPhase section */ 297 | 298 | /* Begin PBXTargetDependency section */ 299 | 3954C68122AB3D12009BB210 /* PBXTargetDependency */ = { 300 | isa = PBXTargetDependency; 301 | target = 3954C66822AB3D10009BB210 /* SwiftUI Chat */; 302 | targetProxy = 3954C68022AB3D12009BB210 /* PBXContainerItemProxy */; 303 | }; 304 | 3954C68C22AB3D12009BB210 /* PBXTargetDependency */ = { 305 | isa = PBXTargetDependency; 306 | target = 3954C66822AB3D10009BB210 /* SwiftUI Chat */; 307 | targetProxy = 3954C68B22AB3D12009BB210 /* PBXContainerItemProxy */; 308 | }; 309 | /* End PBXTargetDependency section */ 310 | 311 | /* Begin PBXVariantGroup section */ 312 | 3954C67722AB3D12009BB210 /* LaunchScreen.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | 3954C67822AB3D12009BB210 /* Base */, 316 | ); 317 | name = LaunchScreen.storyboard; 318 | sourceTree = ""; 319 | }; 320 | /* End PBXVariantGroup section */ 321 | 322 | /* Begin XCBuildConfiguration section */ 323 | 3954C69122AB3D12009BB210 /* Debug */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ALWAYS_SEARCH_USER_PATHS = NO; 327 | CLANG_ANALYZER_NONNULL = YES; 328 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_ENABLE_OBJC_WEAK = YES; 334 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_COMMA = YES; 337 | CLANG_WARN_CONSTANT_CONVERSION = YES; 338 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 341 | CLANG_WARN_EMPTY_BODY = YES; 342 | CLANG_WARN_ENUM_CONVERSION = YES; 343 | CLANG_WARN_INFINITE_RECURSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 347 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 349 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 350 | CLANG_WARN_STRICT_PROTOTYPES = YES; 351 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 352 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 353 | CLANG_WARN_UNREACHABLE_CODE = YES; 354 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = dwarf; 357 | ENABLE_STRICT_OBJC_MSGSEND = YES; 358 | ENABLE_TESTABILITY = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu11; 360 | GCC_DYNAMIC_NO_PIC = NO; 361 | GCC_NO_COMMON_BLOCKS = YES; 362 | GCC_OPTIMIZATION_LEVEL = 0; 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 374 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 375 | MTL_FAST_MATH = YES; 376 | ONLY_ACTIVE_ARCH = YES; 377 | SDKROOT = iphoneos; 378 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 379 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 380 | }; 381 | name = Debug; 382 | }; 383 | 3954C69222AB3D12009BB210 /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | CLANG_ANALYZER_NONNULL = YES; 388 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 389 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 390 | CLANG_CXX_LIBRARY = "libc++"; 391 | CLANG_ENABLE_MODULES = YES; 392 | CLANG_ENABLE_OBJC_ARC = YES; 393 | CLANG_ENABLE_OBJC_WEAK = YES; 394 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_COMMA = YES; 397 | CLANG_WARN_CONSTANT_CONVERSION = YES; 398 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 399 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 400 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 407 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 410 | CLANG_WARN_STRICT_PROTOTYPES = YES; 411 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 412 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 413 | CLANG_WARN_UNREACHABLE_CODE = YES; 414 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 415 | COPY_PHASE_STRIP = NO; 416 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 417 | ENABLE_NS_ASSERTIONS = NO; 418 | ENABLE_STRICT_OBJC_MSGSEND = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu11; 420 | GCC_NO_COMMON_BLOCKS = YES; 421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 423 | GCC_WARN_UNDECLARED_SELECTOR = YES; 424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 425 | GCC_WARN_UNUSED_FUNCTION = YES; 426 | GCC_WARN_UNUSED_VARIABLE = YES; 427 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 428 | MTL_ENABLE_DEBUG_INFO = NO; 429 | MTL_FAST_MATH = YES; 430 | SDKROOT = iphoneos; 431 | SWIFT_COMPILATION_MODE = wholemodule; 432 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 433 | VALIDATE_PRODUCT = YES; 434 | }; 435 | name = Release; 436 | }; 437 | 3954C69422AB3D12009BB210 /* Debug */ = { 438 | isa = XCBuildConfiguration; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | CODE_SIGN_STYLE = Automatic; 442 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI Chat\"/Preview\\ Content"; 443 | DEVELOPMENT_TEAM = 86EQKZ2X82; 444 | ENABLE_PREVIEWS = YES; 445 | INFOPLIST_FILE = "SwiftUI Chat/Info.plist"; 446 | LD_RUNPATH_SEARCH_PATHS = ( 447 | "$(inherited)", 448 | "@executable_path/Frameworks", 449 | ); 450 | PRODUCT_BUNDLE_IDENTIFIER = "nickhalavins.SwiftUI-Chat"; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | SWIFT_VERSION = 5.0; 453 | TARGETED_DEVICE_FAMILY = "1,2"; 454 | }; 455 | name = Debug; 456 | }; 457 | 3954C69522AB3D12009BB210 /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | CODE_SIGN_STYLE = Automatic; 462 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI Chat\"/Preview\\ Content"; 463 | DEVELOPMENT_TEAM = 86EQKZ2X82; 464 | ENABLE_PREVIEWS = YES; 465 | INFOPLIST_FILE = "SwiftUI Chat/Info.plist"; 466 | LD_RUNPATH_SEARCH_PATHS = ( 467 | "$(inherited)", 468 | "@executable_path/Frameworks", 469 | ); 470 | PRODUCT_BUNDLE_IDENTIFIER = "nickhalavins.SwiftUI-Chat"; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | SWIFT_VERSION = 5.0; 473 | TARGETED_DEVICE_FAMILY = "1,2"; 474 | }; 475 | name = Release; 476 | }; 477 | 3954C69722AB3D12009BB210 /* Debug */ = { 478 | isa = XCBuildConfiguration; 479 | buildSettings = { 480 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 481 | BUNDLE_LOADER = "$(TEST_HOST)"; 482 | CODE_SIGN_STYLE = Automatic; 483 | DEVELOPMENT_TEAM = 86EQKZ2X82; 484 | INFOPLIST_FILE = "SwiftUI ChatTests/Info.plist"; 485 | LD_RUNPATH_SEARCH_PATHS = ( 486 | "$(inherited)", 487 | "@executable_path/Frameworks", 488 | "@loader_path/Frameworks", 489 | ); 490 | PRODUCT_BUNDLE_IDENTIFIER = "nickhalavins.SwiftUI-ChatTests"; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | SWIFT_VERSION = 5.0; 493 | TARGETED_DEVICE_FAMILY = "1,2"; 494 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUI Chat.app/SwiftUI Chat"; 495 | }; 496 | name = Debug; 497 | }; 498 | 3954C69822AB3D12009BB210 /* Release */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 502 | BUNDLE_LOADER = "$(TEST_HOST)"; 503 | CODE_SIGN_STYLE = Automatic; 504 | DEVELOPMENT_TEAM = 86EQKZ2X82; 505 | INFOPLIST_FILE = "SwiftUI ChatTests/Info.plist"; 506 | LD_RUNPATH_SEARCH_PATHS = ( 507 | "$(inherited)", 508 | "@executable_path/Frameworks", 509 | "@loader_path/Frameworks", 510 | ); 511 | PRODUCT_BUNDLE_IDENTIFIER = "nickhalavins.SwiftUI-ChatTests"; 512 | PRODUCT_NAME = "$(TARGET_NAME)"; 513 | SWIFT_VERSION = 5.0; 514 | TARGETED_DEVICE_FAMILY = "1,2"; 515 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUI Chat.app/SwiftUI Chat"; 516 | }; 517 | name = Release; 518 | }; 519 | 3954C69A22AB3D12009BB210 /* Debug */ = { 520 | isa = XCBuildConfiguration; 521 | buildSettings = { 522 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 523 | CODE_SIGN_STYLE = Automatic; 524 | DEVELOPMENT_TEAM = 86EQKZ2X82; 525 | INFOPLIST_FILE = "SwiftUI ChatUITests/Info.plist"; 526 | LD_RUNPATH_SEARCH_PATHS = ( 527 | "$(inherited)", 528 | "@executable_path/Frameworks", 529 | "@loader_path/Frameworks", 530 | ); 531 | PRODUCT_BUNDLE_IDENTIFIER = "nickhalavins.SwiftUI-ChatUITests"; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | SWIFT_VERSION = 5.0; 534 | TARGETED_DEVICE_FAMILY = "1,2"; 535 | TEST_TARGET_NAME = "SwiftUI Chat"; 536 | }; 537 | name = Debug; 538 | }; 539 | 3954C69B22AB3D12009BB210 /* Release */ = { 540 | isa = XCBuildConfiguration; 541 | buildSettings = { 542 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 543 | CODE_SIGN_STYLE = Automatic; 544 | DEVELOPMENT_TEAM = 86EQKZ2X82; 545 | INFOPLIST_FILE = "SwiftUI ChatUITests/Info.plist"; 546 | LD_RUNPATH_SEARCH_PATHS = ( 547 | "$(inherited)", 548 | "@executable_path/Frameworks", 549 | "@loader_path/Frameworks", 550 | ); 551 | PRODUCT_BUNDLE_IDENTIFIER = "nickhalavins.SwiftUI-ChatUITests"; 552 | PRODUCT_NAME = "$(TARGET_NAME)"; 553 | SWIFT_VERSION = 5.0; 554 | TARGETED_DEVICE_FAMILY = "1,2"; 555 | TEST_TARGET_NAME = "SwiftUI Chat"; 556 | }; 557 | name = Release; 558 | }; 559 | /* End XCBuildConfiguration section */ 560 | 561 | /* Begin XCConfigurationList section */ 562 | 3954C66422AB3D10009BB210 /* Build configuration list for PBXProject "SwiftUI Chat" */ = { 563 | isa = XCConfigurationList; 564 | buildConfigurations = ( 565 | 3954C69122AB3D12009BB210 /* Debug */, 566 | 3954C69222AB3D12009BB210 /* Release */, 567 | ); 568 | defaultConfigurationIsVisible = 0; 569 | defaultConfigurationName = Release; 570 | }; 571 | 3954C69322AB3D12009BB210 /* Build configuration list for PBXNativeTarget "SwiftUI Chat" */ = { 572 | isa = XCConfigurationList; 573 | buildConfigurations = ( 574 | 3954C69422AB3D12009BB210 /* Debug */, 575 | 3954C69522AB3D12009BB210 /* Release */, 576 | ); 577 | defaultConfigurationIsVisible = 0; 578 | defaultConfigurationName = Release; 579 | }; 580 | 3954C69622AB3D12009BB210 /* Build configuration list for PBXNativeTarget "SwiftUI ChatTests" */ = { 581 | isa = XCConfigurationList; 582 | buildConfigurations = ( 583 | 3954C69722AB3D12009BB210 /* Debug */, 584 | 3954C69822AB3D12009BB210 /* Release */, 585 | ); 586 | defaultConfigurationIsVisible = 0; 587 | defaultConfigurationName = Release; 588 | }; 589 | 3954C69922AB3D12009BB210 /* Build configuration list for PBXNativeTarget "SwiftUI ChatUITests" */ = { 590 | isa = XCConfigurationList; 591 | buildConfigurations = ( 592 | 3954C69A22AB3D12009BB210 /* Debug */, 593 | 3954C69B22AB3D12009BB210 /* Release */, 594 | ); 595 | defaultConfigurationIsVisible = 0; 596 | defaultConfigurationName = Release; 597 | }; 598 | /* End XCConfigurationList section */ 599 | }; 600 | rootObject = 3954C66122AB3D10009BB210 /* Project object */; 601 | } 602 | -------------------------------------------------------------------------------- /SwiftUI Chat.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftUI Chat.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftUI Chat.xcodeproj/xcuserdata/halvini.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftUI Chat.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SwiftUI Chat/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftUI Chat 4 | // 5 | // Created by Nick Halavins on 6/7/19. 6 | // Copyright © 2019 AntiChat, Inc. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillTerminate(_ application: UIApplication) { 22 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 23 | } 24 | 25 | // MARK: UISceneSession Lifecycle 26 | 27 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 28 | // Called when a new scene session is being created. 29 | // Use this method to select a configuration to create the new scene with. 30 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 31 | } 32 | 33 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 34 | // Called when the user discards a scene session. 35 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 36 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 37 | } 38 | 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /SwiftUI Chat/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /SwiftUI Chat/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUI Chat/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftUI Chat/ChatController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChatController.swift 3 | // SwiftUI Chat 4 | // 5 | // Created by Nick Halavins on 6/7/19. Updated 10/11/19 6 | // Copyright © 2019 AntiLand. All rights reserved. 7 | // 8 | import Combine 9 | import SwiftUI 10 | 11 | // ChatController needs to be a ObservableObject in order 12 | // to be accessible by SwiftUI 13 | class ChatController : ObservableObject { 14 | // didChange will let the SwiftUI know that some changes have happened in this object 15 | // and we need to rebuild all the views related to that object 16 | var didChange = PassthroughSubject() 17 | 18 | // We've relocated the messages from the main SwiftUI View. Now, if you wish, you can handle the networking part here and populate this array with any data from your database. If you do so, please share your code and let's build the first global open-source chat app in SwiftUI together 19 | @Published var messages = [ 20 | ChatMessage(message: "Hello world", avatar: "A", color: .red), 21 | ChatMessage(message: "Hi", avatar: "B", color: .blue) 22 | ] 23 | 24 | // this function will be accessible from SwiftUI main view 25 | // here you can add the necessary code to send your messages not only to the SwiftUI view, but also to the database so that other users of the app would be able to see it 26 | func sendMessage(_ chatMessage: ChatMessage) { 27 | // here we populate the messages array 28 | messages.append(chatMessage) 29 | // here we let the SwiftUI know that we need to rebuild the views 30 | didChange.send(()) 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /SwiftUI Chat/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // SwiftUI Chat 4 | // 5 | // Created by Nick Halavins on 6/7/19. Updated 10/11/19 6 | // Copyright © 2019 AntiLand. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | // let's create a structure that will represent each message in chat 12 | struct ChatMessage : Hashable { 13 | var message: String 14 | var avatar: String 15 | var color: Color 16 | // isMe will be true if We sent the message 17 | var isMe: Bool = false 18 | } 19 | 20 | struct ContentView : View { 21 | 22 | // @State here is necessary to make the composedMessage variable accessible from different views 23 | @State var composedMessage: String = "" 24 | @EnvironmentObject var chatController: ChatController 25 | 26 | var body: some View { 27 | 28 | // the VStack is a vertical stack where we place all our substacks like the List and the TextField 29 | VStack { 30 | // I've removed the text line from here and replaced it with a list 31 | // List is the way you should create any list in SwiftUI 32 | List { 33 | // we have several messages so we use the For Loop 34 | ForEach(chatController.messages, id: \.self) { msg in 35 | ChatRow(chatMessage: msg) 36 | } 37 | } 38 | 39 | // TextField are aligned with the Send Button in the same line so we put them in HStack 40 | HStack { 41 | // this textField generates the value for the composedMessage @State var 42 | TextField("Message...", text: $composedMessage).frame(minHeight: CGFloat(30)) 43 | // the button triggers the sendMessage() function written in the end of current View 44 | Button(action: sendMessage) { 45 | Text("Send") 46 | } 47 | }.frame(minHeight: CGFloat(50)).padding() 48 | // that's the height of the HStack 49 | } 50 | } 51 | func sendMessage() { 52 | chatController.sendMessage(ChatMessage(message: composedMessage, avatar: "C", color: .green, isMe: true)) 53 | composedMessage = "" 54 | } 55 | } 56 | 57 | // ChatRow will be a view similar to a Cell in standard Swift 58 | struct ChatRow : View { 59 | // we will need to access and represent the chatMessages here 60 | var chatMessage: ChatMessage 61 | // body - is the body of the view, just like the body of the first view we created when opened the project 62 | var body: some View { 63 | // HStack - is a horizontal stack. We let the SwiftUI know that we need to place 64 | // all the following contents horizontally one after another 65 | Group { 66 | if !chatMessage.isMe { 67 | HStack { 68 | Group { 69 | Text(chatMessage.avatar) 70 | Text(chatMessage.message) 71 | .bold() 72 | .padding(10) 73 | .foregroundColor(Color.white) 74 | .background(chatMessage.color) 75 | .cornerRadius(10) 76 | } 77 | } 78 | } else { 79 | HStack { 80 | Group { 81 | Spacer() 82 | Text(chatMessage.message) 83 | .bold() 84 | .foregroundColor(Color.white) 85 | .padding(10) 86 | .background(chatMessage.color) 87 | .cornerRadius(10) 88 | Text(chatMessage.avatar) 89 | } 90 | } 91 | } 92 | } 93 | 94 | } 95 | } 96 | 97 | #if DEBUG 98 | struct ContentView_Previews : PreviewProvider { 99 | static var previews: some View { 100 | ContentView() 101 | .environmentObject(ChatController()) 102 | } 103 | } 104 | #endif 105 | -------------------------------------------------------------------------------- /SwiftUI Chat/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UISceneConfigurationName 35 | Default Configuration 36 | UISceneDelegateClassName 37 | $(PRODUCT_MODULE_NAME).SceneDelegate 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /SwiftUI Chat/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUI Chat/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // SwiftUI Chat App 4 | // 5 | // Created by Nick Halavins on 10/11/19. 6 | // Copyright © 2019 AntiChat, Inc. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | var chatController = ChatController() 16 | 17 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 21 | 22 | // Create the SwiftUI view that provides the window contents. 23 | let contentView = ContentView() 24 | 25 | // Use a UIHostingController as window root view controller. 26 | if let windowScene = scene as? UIWindowScene { 27 | let window = UIWindow(windowScene: windowScene) 28 | window.rootViewController = UIHostingController(rootView: contentView.environmentObject(chatController)) 29 | self.window = window 30 | window.makeKeyAndVisible() 31 | } 32 | } 33 | 34 | func sceneDidDisconnect(_ scene: UIScene) { 35 | // Called as the scene is being released by the system. 36 | // This occurs shortly after the scene enters the background, or when its session is discarded. 37 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 38 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 39 | } 40 | 41 | func sceneDidBecomeActive(_ scene: UIScene) { 42 | // Called when the scene has moved from an inactive state to an active state. 43 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 44 | } 45 | 46 | func sceneWillResignActive(_ scene: UIScene) { 47 | // Called when the scene will move from an active state to an inactive state. 48 | // This may occur due to temporary interruptions (ex. an incoming phone call). 49 | } 50 | 51 | func sceneWillEnterForeground(_ scene: UIScene) { 52 | // Called as the scene transitions from the background to the foreground. 53 | // Use this method to undo the changes made on entering the background. 54 | } 55 | 56 | func sceneDidEnterBackground(_ scene: UIScene) { 57 | // Called as the scene transitions from the foreground to the background. 58 | // Use this method to save data, release shared resources, and store enough scene-specific state information 59 | // to restore the scene back to its current state. 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /SwiftUI ChatTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SwiftUI ChatTests/SwiftUI_ChatTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftUI_ChatTests.swift 3 | // SwiftUI ChatTests 4 | // 5 | // Created by Nick Halavins on 6/7/19. 6 | // Copyright © 2019 AntiChat, Inc. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import SwiftUI_Chat 11 | 12 | class SwiftUI_ChatTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /SwiftUI ChatUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SwiftUI ChatUITests/SwiftUI_ChatUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftUI_ChatUITests.swift 3 | // SwiftUI ChatUITests 4 | // 5 | // Created by Nick Halavins on 6/7/19. 6 | // Copyright © 2019 AntiChat, Inc. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class SwiftUI_ChatUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 20 | XCUIApplication().launch() 21 | 22 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 23 | } 24 | 25 | override func tearDown() { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | } 28 | 29 | func testExample() { 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | } 35 | --------------------------------------------------------------------------------