├── MultipeerConnectiveDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── MultipeerConnectiveDemo ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── bannzai.imageset │ │ ├── Contents.json │ │ └── bannzai27.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SceneDelegate.swift └── ViewController.swift ├── MultipeerConnectiveDemoTests ├── Info.plist └── MultipeerConnectiveDemoTests.swift └── MultipeerConnectiveDemoUITests ├── Info.plist └── MultipeerConnectiveDemoUITests.swift /MultipeerConnectiveDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BA97397E2603AB18005D8537 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA97397D2603AB18005D8537 /* AppDelegate.swift */; }; 11 | BA9739802603AB18005D8537 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA97397F2603AB18005D8537 /* SceneDelegate.swift */; }; 12 | BA9739822603AB18005D8537 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9739812603AB18005D8537 /* ViewController.swift */; }; 13 | BA9739852603AB18005D8537 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA9739832603AB18005D8537 /* Main.storyboard */; }; 14 | BA9739872603AB1A005D8537 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA9739862603AB1A005D8537 /* Assets.xcassets */; }; 15 | BA97398A2603AB1A005D8537 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA9739882603AB1A005D8537 /* LaunchScreen.storyboard */; }; 16 | BA9739952603AB1B005D8537 /* MultipeerConnectiveDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA9739942603AB1B005D8537 /* MultipeerConnectiveDemoTests.swift */; }; 17 | BA9739A02603AB1B005D8537 /* MultipeerConnectiveDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA97399F2603AB1B005D8537 /* MultipeerConnectiveDemoUITests.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | BA9739912603AB1B005D8537 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = BA9739722603AB18005D8537 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = BA9739792603AB18005D8537; 26 | remoteInfo = MultipeerConnectiveDemo; 27 | }; 28 | BA97399C2603AB1B005D8537 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = BA9739722603AB18005D8537 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = BA9739792603AB18005D8537; 33 | remoteInfo = MultipeerConnectiveDemo; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | BA97397A2603AB18005D8537 /* MultipeerConnectiveDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultipeerConnectiveDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | BA97397D2603AB18005D8537 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | BA97397F2603AB18005D8537 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 41 | BA9739812603AB18005D8537 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | BA9739842603AB18005D8537 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | BA9739862603AB1A005D8537 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | BA9739892603AB1A005D8537 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | BA97398B2603AB1A005D8537 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | BA9739902603AB1B005D8537 /* MultipeerConnectiveDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MultipeerConnectiveDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | BA9739942603AB1B005D8537 /* MultipeerConnectiveDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipeerConnectiveDemoTests.swift; sourceTree = ""; }; 48 | BA9739962603AB1B005D8537 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | BA97399B2603AB1B005D8537 /* MultipeerConnectiveDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MultipeerConnectiveDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | BA97399F2603AB1B005D8537 /* MultipeerConnectiveDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipeerConnectiveDemoUITests.swift; sourceTree = ""; }; 51 | BA9739A12603AB1B005D8537 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | BA9739772603AB18005D8537 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | BA97398D2603AB1B005D8537 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | BA9739982603AB1B005D8537 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | BA9739712603AB18005D8537 = { 80 | isa = PBXGroup; 81 | children = ( 82 | BA97397C2603AB18005D8537 /* MultipeerConnectiveDemo */, 83 | BA9739932603AB1B005D8537 /* MultipeerConnectiveDemoTests */, 84 | BA97399E2603AB1B005D8537 /* MultipeerConnectiveDemoUITests */, 85 | BA97397B2603AB18005D8537 /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | BA97397B2603AB18005D8537 /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | BA97397A2603AB18005D8537 /* MultipeerConnectiveDemo.app */, 93 | BA9739902603AB1B005D8537 /* MultipeerConnectiveDemoTests.xctest */, 94 | BA97399B2603AB1B005D8537 /* MultipeerConnectiveDemoUITests.xctest */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | BA97397C2603AB18005D8537 /* MultipeerConnectiveDemo */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | BA97397D2603AB18005D8537 /* AppDelegate.swift */, 103 | BA97397F2603AB18005D8537 /* SceneDelegate.swift */, 104 | BA9739812603AB18005D8537 /* ViewController.swift */, 105 | BA9739832603AB18005D8537 /* Main.storyboard */, 106 | BA9739862603AB1A005D8537 /* Assets.xcassets */, 107 | BA9739882603AB1A005D8537 /* LaunchScreen.storyboard */, 108 | BA97398B2603AB1A005D8537 /* Info.plist */, 109 | ); 110 | path = MultipeerConnectiveDemo; 111 | sourceTree = ""; 112 | }; 113 | BA9739932603AB1B005D8537 /* MultipeerConnectiveDemoTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | BA9739942603AB1B005D8537 /* MultipeerConnectiveDemoTests.swift */, 117 | BA9739962603AB1B005D8537 /* Info.plist */, 118 | ); 119 | path = MultipeerConnectiveDemoTests; 120 | sourceTree = ""; 121 | }; 122 | BA97399E2603AB1B005D8537 /* MultipeerConnectiveDemoUITests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | BA97399F2603AB1B005D8537 /* MultipeerConnectiveDemoUITests.swift */, 126 | BA9739A12603AB1B005D8537 /* Info.plist */, 127 | ); 128 | path = MultipeerConnectiveDemoUITests; 129 | sourceTree = ""; 130 | }; 131 | /* End PBXGroup section */ 132 | 133 | /* Begin PBXNativeTarget section */ 134 | BA9739792603AB18005D8537 /* MultipeerConnectiveDemo */ = { 135 | isa = PBXNativeTarget; 136 | buildConfigurationList = BA9739A42603AB1B005D8537 /* Build configuration list for PBXNativeTarget "MultipeerConnectiveDemo" */; 137 | buildPhases = ( 138 | BA9739762603AB18005D8537 /* Sources */, 139 | BA9739772603AB18005D8537 /* Frameworks */, 140 | BA9739782603AB18005D8537 /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = MultipeerConnectiveDemo; 147 | productName = MultipeerConnectiveDemo; 148 | productReference = BA97397A2603AB18005D8537 /* MultipeerConnectiveDemo.app */; 149 | productType = "com.apple.product-type.application"; 150 | }; 151 | BA97398F2603AB1B005D8537 /* MultipeerConnectiveDemoTests */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = BA9739A72603AB1B005D8537 /* Build configuration list for PBXNativeTarget "MultipeerConnectiveDemoTests" */; 154 | buildPhases = ( 155 | BA97398C2603AB1B005D8537 /* Sources */, 156 | BA97398D2603AB1B005D8537 /* Frameworks */, 157 | BA97398E2603AB1B005D8537 /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | BA9739922603AB1B005D8537 /* PBXTargetDependency */, 163 | ); 164 | name = MultipeerConnectiveDemoTests; 165 | productName = MultipeerConnectiveDemoTests; 166 | productReference = BA9739902603AB1B005D8537 /* MultipeerConnectiveDemoTests.xctest */; 167 | productType = "com.apple.product-type.bundle.unit-test"; 168 | }; 169 | BA97399A2603AB1B005D8537 /* MultipeerConnectiveDemoUITests */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = BA9739AA2603AB1B005D8537 /* Build configuration list for PBXNativeTarget "MultipeerConnectiveDemoUITests" */; 172 | buildPhases = ( 173 | BA9739972603AB1B005D8537 /* Sources */, 174 | BA9739982603AB1B005D8537 /* Frameworks */, 175 | BA9739992603AB1B005D8537 /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | BA97399D2603AB1B005D8537 /* PBXTargetDependency */, 181 | ); 182 | name = MultipeerConnectiveDemoUITests; 183 | productName = MultipeerConnectiveDemoUITests; 184 | productReference = BA97399B2603AB1B005D8537 /* MultipeerConnectiveDemoUITests.xctest */; 185 | productType = "com.apple.product-type.bundle.ui-testing"; 186 | }; 187 | /* End PBXNativeTarget section */ 188 | 189 | /* Begin PBXProject section */ 190 | BA9739722603AB18005D8537 /* Project object */ = { 191 | isa = PBXProject; 192 | attributes = { 193 | LastSwiftUpdateCheck = 1240; 194 | LastUpgradeCheck = 1240; 195 | TargetAttributes = { 196 | BA9739792603AB18005D8537 = { 197 | CreatedOnToolsVersion = 12.4; 198 | }; 199 | BA97398F2603AB1B005D8537 = { 200 | CreatedOnToolsVersion = 12.4; 201 | TestTargetID = BA9739792603AB18005D8537; 202 | }; 203 | BA97399A2603AB1B005D8537 = { 204 | CreatedOnToolsVersion = 12.4; 205 | TestTargetID = BA9739792603AB18005D8537; 206 | }; 207 | }; 208 | }; 209 | buildConfigurationList = BA9739752603AB18005D8537 /* Build configuration list for PBXProject "MultipeerConnectiveDemo" */; 210 | compatibilityVersion = "Xcode 9.3"; 211 | developmentRegion = en; 212 | hasScannedForEncodings = 0; 213 | knownRegions = ( 214 | en, 215 | Base, 216 | ); 217 | mainGroup = BA9739712603AB18005D8537; 218 | productRefGroup = BA97397B2603AB18005D8537 /* Products */; 219 | projectDirPath = ""; 220 | projectRoot = ""; 221 | targets = ( 222 | BA9739792603AB18005D8537 /* MultipeerConnectiveDemo */, 223 | BA97398F2603AB1B005D8537 /* MultipeerConnectiveDemoTests */, 224 | BA97399A2603AB1B005D8537 /* MultipeerConnectiveDemoUITests */, 225 | ); 226 | }; 227 | /* End PBXProject section */ 228 | 229 | /* Begin PBXResourcesBuildPhase section */ 230 | BA9739782603AB18005D8537 /* Resources */ = { 231 | isa = PBXResourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | BA97398A2603AB1A005D8537 /* LaunchScreen.storyboard in Resources */, 235 | BA9739872603AB1A005D8537 /* Assets.xcassets in Resources */, 236 | BA9739852603AB18005D8537 /* Main.storyboard in Resources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | BA97398E2603AB1B005D8537 /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | BA9739992603AB1B005D8537 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXResourcesBuildPhase section */ 255 | 256 | /* Begin PBXSourcesBuildPhase section */ 257 | BA9739762603AB18005D8537 /* Sources */ = { 258 | isa = PBXSourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | BA9739822603AB18005D8537 /* ViewController.swift in Sources */, 262 | BA97397E2603AB18005D8537 /* AppDelegate.swift in Sources */, 263 | BA9739802603AB18005D8537 /* SceneDelegate.swift in Sources */, 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | BA97398C2603AB1B005D8537 /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | BA9739952603AB1B005D8537 /* MultipeerConnectiveDemoTests.swift in Sources */, 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | BA9739972603AB1B005D8537 /* Sources */ = { 276 | isa = PBXSourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | BA9739A02603AB1B005D8537 /* MultipeerConnectiveDemoUITests.swift in Sources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXSourcesBuildPhase section */ 284 | 285 | /* Begin PBXTargetDependency section */ 286 | BA9739922603AB1B005D8537 /* PBXTargetDependency */ = { 287 | isa = PBXTargetDependency; 288 | target = BA9739792603AB18005D8537 /* MultipeerConnectiveDemo */; 289 | targetProxy = BA9739912603AB1B005D8537 /* PBXContainerItemProxy */; 290 | }; 291 | BA97399D2603AB1B005D8537 /* PBXTargetDependency */ = { 292 | isa = PBXTargetDependency; 293 | target = BA9739792603AB18005D8537 /* MultipeerConnectiveDemo */; 294 | targetProxy = BA97399C2603AB1B005D8537 /* PBXContainerItemProxy */; 295 | }; 296 | /* End PBXTargetDependency section */ 297 | 298 | /* Begin PBXVariantGroup section */ 299 | BA9739832603AB18005D8537 /* Main.storyboard */ = { 300 | isa = PBXVariantGroup; 301 | children = ( 302 | BA9739842603AB18005D8537 /* Base */, 303 | ); 304 | name = Main.storyboard; 305 | sourceTree = ""; 306 | }; 307 | BA9739882603AB1A005D8537 /* LaunchScreen.storyboard */ = { 308 | isa = PBXVariantGroup; 309 | children = ( 310 | BA9739892603AB1A005D8537 /* Base */, 311 | ); 312 | name = LaunchScreen.storyboard; 313 | sourceTree = ""; 314 | }; 315 | /* End PBXVariantGroup section */ 316 | 317 | /* Begin XCBuildConfiguration section */ 318 | BA9739A22603AB1B005D8537 /* Debug */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | ALWAYS_SEARCH_USER_PATHS = NO; 322 | CLANG_ANALYZER_NONNULL = YES; 323 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 325 | CLANG_CXX_LIBRARY = "libc++"; 326 | CLANG_ENABLE_MODULES = YES; 327 | CLANG_ENABLE_OBJC_ARC = YES; 328 | CLANG_ENABLE_OBJC_WEAK = YES; 329 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_COMMA = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 336 | CLANG_WARN_EMPTY_BODY = YES; 337 | CLANG_WARN_ENUM_CONVERSION = YES; 338 | CLANG_WARN_INFINITE_RECURSION = YES; 339 | CLANG_WARN_INT_CONVERSION = YES; 340 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 341 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 342 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 345 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 346 | CLANG_WARN_STRICT_PROTOTYPES = YES; 347 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 348 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 349 | CLANG_WARN_UNREACHABLE_CODE = YES; 350 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 351 | COPY_PHASE_STRIP = NO; 352 | DEBUG_INFORMATION_FORMAT = dwarf; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | ENABLE_TESTABILITY = YES; 355 | GCC_C_LANGUAGE_STANDARD = gnu11; 356 | GCC_DYNAMIC_NO_PIC = NO; 357 | GCC_NO_COMMON_BLOCKS = YES; 358 | GCC_OPTIMIZATION_LEVEL = 0; 359 | GCC_PREPROCESSOR_DEFINITIONS = ( 360 | "DEBUG=1", 361 | "$(inherited)", 362 | ); 363 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 364 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 365 | GCC_WARN_UNDECLARED_SELECTOR = YES; 366 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 367 | GCC_WARN_UNUSED_FUNCTION = YES; 368 | GCC_WARN_UNUSED_VARIABLE = YES; 369 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 370 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 371 | MTL_FAST_MATH = YES; 372 | ONLY_ACTIVE_ARCH = YES; 373 | SDKROOT = iphoneos; 374 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 375 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 376 | }; 377 | name = Debug; 378 | }; 379 | BA9739A32603AB1B005D8537 /* Release */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ALWAYS_SEARCH_USER_PATHS = NO; 383 | CLANG_ANALYZER_NONNULL = YES; 384 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 385 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 386 | CLANG_CXX_LIBRARY = "libc++"; 387 | CLANG_ENABLE_MODULES = YES; 388 | CLANG_ENABLE_OBJC_ARC = YES; 389 | CLANG_ENABLE_OBJC_WEAK = YES; 390 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 391 | CLANG_WARN_BOOL_CONVERSION = YES; 392 | CLANG_WARN_COMMA = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 395 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 396 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 397 | CLANG_WARN_EMPTY_BODY = YES; 398 | CLANG_WARN_ENUM_CONVERSION = YES; 399 | CLANG_WARN_INFINITE_RECURSION = YES; 400 | CLANG_WARN_INT_CONVERSION = YES; 401 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 402 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 403 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 404 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 405 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 406 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 407 | CLANG_WARN_STRICT_PROTOTYPES = YES; 408 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 409 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 410 | CLANG_WARN_UNREACHABLE_CODE = YES; 411 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 412 | COPY_PHASE_STRIP = NO; 413 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 414 | ENABLE_NS_ASSERTIONS = NO; 415 | ENABLE_STRICT_OBJC_MSGSEND = YES; 416 | GCC_C_LANGUAGE_STANDARD = gnu11; 417 | GCC_NO_COMMON_BLOCKS = YES; 418 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 419 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 420 | GCC_WARN_UNDECLARED_SELECTOR = YES; 421 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 422 | GCC_WARN_UNUSED_FUNCTION = YES; 423 | GCC_WARN_UNUSED_VARIABLE = YES; 424 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 425 | MTL_ENABLE_DEBUG_INFO = NO; 426 | MTL_FAST_MATH = YES; 427 | SDKROOT = iphoneos; 428 | SWIFT_COMPILATION_MODE = wholemodule; 429 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | BA9739A52603AB1B005D8537 /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 438 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 439 | CODE_SIGN_STYLE = Automatic; 440 | DEVELOPMENT_TEAM = TQPN82UBBY; 441 | INFOPLIST_FILE = MultipeerConnectiveDemo/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = ( 443 | "$(inherited)", 444 | "@executable_path/Frameworks", 445 | ); 446 | PRODUCT_BUNDLE_IDENTIFIER = com.bannzai.MultipeerConnectiveDemo.MultipeerConnectiveDemo; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | SWIFT_VERSION = 5.0; 449 | TARGETED_DEVICE_FAMILY = "1,2"; 450 | }; 451 | name = Debug; 452 | }; 453 | BA9739A62603AB1B005D8537 /* Release */ = { 454 | isa = XCBuildConfiguration; 455 | buildSettings = { 456 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 457 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 458 | CODE_SIGN_STYLE = Automatic; 459 | DEVELOPMENT_TEAM = TQPN82UBBY; 460 | INFOPLIST_FILE = MultipeerConnectiveDemo/Info.plist; 461 | LD_RUNPATH_SEARCH_PATHS = ( 462 | "$(inherited)", 463 | "@executable_path/Frameworks", 464 | ); 465 | PRODUCT_BUNDLE_IDENTIFIER = com.bannzai.MultipeerConnectiveDemo.MultipeerConnectiveDemo; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | SWIFT_VERSION = 5.0; 468 | TARGETED_DEVICE_FAMILY = "1,2"; 469 | }; 470 | name = Release; 471 | }; 472 | BA9739A82603AB1B005D8537 /* Debug */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 476 | BUNDLE_LOADER = "$(TEST_HOST)"; 477 | CODE_SIGN_STYLE = Automatic; 478 | INFOPLIST_FILE = MultipeerConnectiveDemoTests/Info.plist; 479 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 480 | LD_RUNPATH_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "@executable_path/Frameworks", 483 | "@loader_path/Frameworks", 484 | ); 485 | PRODUCT_BUNDLE_IDENTIFIER = com.bannzai.MultipeerConnectiveDemo.MultipeerConnectiveDemoTests; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | SWIFT_VERSION = 5.0; 488 | TARGETED_DEVICE_FAMILY = "1,2"; 489 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MultipeerConnectiveDemo.app/MultipeerConnectiveDemo"; 490 | }; 491 | name = Debug; 492 | }; 493 | BA9739A92603AB1B005D8537 /* Release */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 497 | BUNDLE_LOADER = "$(TEST_HOST)"; 498 | CODE_SIGN_STYLE = Automatic; 499 | INFOPLIST_FILE = MultipeerConnectiveDemoTests/Info.plist; 500 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 501 | LD_RUNPATH_SEARCH_PATHS = ( 502 | "$(inherited)", 503 | "@executable_path/Frameworks", 504 | "@loader_path/Frameworks", 505 | ); 506 | PRODUCT_BUNDLE_IDENTIFIER = com.bannzai.MultipeerConnectiveDemo.MultipeerConnectiveDemoTests; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | SWIFT_VERSION = 5.0; 509 | TARGETED_DEVICE_FAMILY = "1,2"; 510 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MultipeerConnectiveDemo.app/MultipeerConnectiveDemo"; 511 | }; 512 | name = Release; 513 | }; 514 | BA9739AB2603AB1B005D8537 /* Debug */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 518 | CODE_SIGN_STYLE = Automatic; 519 | INFOPLIST_FILE = MultipeerConnectiveDemoUITests/Info.plist; 520 | LD_RUNPATH_SEARCH_PATHS = ( 521 | "$(inherited)", 522 | "@executable_path/Frameworks", 523 | "@loader_path/Frameworks", 524 | ); 525 | PRODUCT_BUNDLE_IDENTIFIER = com.bannzai.MultipeerConnectiveDemo.MultipeerConnectiveDemoUITests; 526 | PRODUCT_NAME = "$(TARGET_NAME)"; 527 | SWIFT_VERSION = 5.0; 528 | TARGETED_DEVICE_FAMILY = "1,2"; 529 | TEST_TARGET_NAME = MultipeerConnectiveDemo; 530 | }; 531 | name = Debug; 532 | }; 533 | BA9739AC2603AB1B005D8537 /* Release */ = { 534 | isa = XCBuildConfiguration; 535 | buildSettings = { 536 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 537 | CODE_SIGN_STYLE = Automatic; 538 | INFOPLIST_FILE = MultipeerConnectiveDemoUITests/Info.plist; 539 | LD_RUNPATH_SEARCH_PATHS = ( 540 | "$(inherited)", 541 | "@executable_path/Frameworks", 542 | "@loader_path/Frameworks", 543 | ); 544 | PRODUCT_BUNDLE_IDENTIFIER = com.bannzai.MultipeerConnectiveDemo.MultipeerConnectiveDemoUITests; 545 | PRODUCT_NAME = "$(TARGET_NAME)"; 546 | SWIFT_VERSION = 5.0; 547 | TARGETED_DEVICE_FAMILY = "1,2"; 548 | TEST_TARGET_NAME = MultipeerConnectiveDemo; 549 | }; 550 | name = Release; 551 | }; 552 | /* End XCBuildConfiguration section */ 553 | 554 | /* Begin XCConfigurationList section */ 555 | BA9739752603AB18005D8537 /* Build configuration list for PBXProject "MultipeerConnectiveDemo" */ = { 556 | isa = XCConfigurationList; 557 | buildConfigurations = ( 558 | BA9739A22603AB1B005D8537 /* Debug */, 559 | BA9739A32603AB1B005D8537 /* Release */, 560 | ); 561 | defaultConfigurationIsVisible = 0; 562 | defaultConfigurationName = Release; 563 | }; 564 | BA9739A42603AB1B005D8537 /* Build configuration list for PBXNativeTarget "MultipeerConnectiveDemo" */ = { 565 | isa = XCConfigurationList; 566 | buildConfigurations = ( 567 | BA9739A52603AB1B005D8537 /* Debug */, 568 | BA9739A62603AB1B005D8537 /* Release */, 569 | ); 570 | defaultConfigurationIsVisible = 0; 571 | defaultConfigurationName = Release; 572 | }; 573 | BA9739A72603AB1B005D8537 /* Build configuration list for PBXNativeTarget "MultipeerConnectiveDemoTests" */ = { 574 | isa = XCConfigurationList; 575 | buildConfigurations = ( 576 | BA9739A82603AB1B005D8537 /* Debug */, 577 | BA9739A92603AB1B005D8537 /* Release */, 578 | ); 579 | defaultConfigurationIsVisible = 0; 580 | defaultConfigurationName = Release; 581 | }; 582 | BA9739AA2603AB1B005D8537 /* Build configuration list for PBXNativeTarget "MultipeerConnectiveDemoUITests" */ = { 583 | isa = XCConfigurationList; 584 | buildConfigurations = ( 585 | BA9739AB2603AB1B005D8537 /* Debug */, 586 | BA9739AC2603AB1B005D8537 /* Release */, 587 | ); 588 | defaultConfigurationIsVisible = 0; 589 | defaultConfigurationName = Release; 590 | }; 591 | /* End XCConfigurationList section */ 592 | }; 593 | rootObject = BA9739722603AB18005D8537 /* Project object */; 594 | } 595 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MultipeerConnectiveDemo 4 | // 5 | // Created by Yudai.Hirose on 2021/03/19. 6 | // 7 | 8 | import UIKit 9 | 10 | @main 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | // MARK: UISceneSession Lifecycle 21 | 22 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 23 | // Called when a new scene session is being created. 24 | // Use this method to select a configuration to create the new scene with. 25 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 26 | } 27 | 28 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 29 | // Called when the user discards a scene session. 30 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 31 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 32 | } 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/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 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/Assets.xcassets/bannzai.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "bannzai27.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/Assets.xcassets/bannzai.imageset/bannzai27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bannzai/MultipeerConnectiveDemo/e7e35c40053d314b24b41adc99253c569e809101/MultipeerConnectiveDemo/Assets.xcassets/bannzai.imageset/bannzai27.png -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/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 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/Base.lproj/Main.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSLocalNetworkUsageDescription 6 | ローカルネットワークと通信するお 7 | NSBonjourServices 8 | 9 | _bannzai-p2p._tcp 10 | _bannzai-p2p._udp 11 | 12 | CFBundleDevelopmentRegion 13 | $(DEVELOPMENT_LANGUAGE) 14 | CFBundleExecutable 15 | $(EXECUTABLE_NAME) 16 | CFBundleIdentifier 17 | $(PRODUCT_BUNDLE_IDENTIFIER) 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | $(PRODUCT_NAME) 22 | CFBundlePackageType 23 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 24 | CFBundleShortVersionString 25 | 1.0 26 | CFBundleVersion 27 | 1 28 | LSRequiresIPhoneOS 29 | 30 | UIApplicationSceneManifest 31 | 32 | UIApplicationSupportsMultipleScenes 33 | 34 | UISceneConfigurations 35 | 36 | UIWindowSceneSessionRoleApplication 37 | 38 | 39 | UISceneConfigurationName 40 | Default Configuration 41 | UISceneDelegateClassName 42 | $(PRODUCT_MODULE_NAME).SceneDelegate 43 | UISceneStoryboardFile 44 | Main 45 | 46 | 47 | 48 | 49 | UIApplicationSupportsIndirectInputEvents 50 | 51 | UILaunchStoryboardName 52 | LaunchScreen 53 | UIMainStoryboardFile 54 | Main 55 | UIRequiredDeviceCapabilities 56 | 57 | armv7 58 | 59 | UISupportedInterfaceOrientations 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | UISupportedInterfaceOrientations~ipad 66 | 67 | UIInterfaceOrientationPortrait 68 | UIInterfaceOrientationPortraitUpsideDown 69 | UIInterfaceOrientationLandscapeLeft 70 | UIInterfaceOrientationLandscapeRight 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // MultipeerConnectiveDemo 4 | // 5 | // Created by Yudai.Hirose on 2021/03/19. 6 | // 7 | 8 | import UIKit 9 | 10 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 17 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 18 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 19 | guard let _ = (scene as? UIWindowScene) else { return } 20 | } 21 | 22 | func sceneDidDisconnect(_ scene: UIScene) { 23 | // Called as the scene is being released by the system. 24 | // This occurs shortly after the scene enters the background, or when its session is discarded. 25 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 26 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 27 | } 28 | 29 | func sceneDidBecomeActive(_ scene: UIScene) { 30 | // Called when the scene has moved from an inactive state to an active state. 31 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 32 | } 33 | 34 | func sceneWillResignActive(_ scene: UIScene) { 35 | // Called when the scene will move from an active state to an inactive state. 36 | // This may occur due to temporary interruptions (ex. an incoming phone call). 37 | } 38 | 39 | func sceneWillEnterForeground(_ scene: UIScene) { 40 | // Called as the scene transitions from the background to the foreground. 41 | // Use this method to undo the changes made on entering the background. 42 | } 43 | 44 | func sceneDidEnterBackground(_ scene: UIScene) { 45 | // Called as the scene transitions from the foreground to the background. 46 | // Use this method to save data, release shared resources, and store enough scene-specific state information 47 | // to restore the scene back to its current state. 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // MultipeerConnectiveDemo 4 | // 5 | // Created by Yudai.Hirose on 2021/03/19. 6 | // 7 | 8 | import UIKit 9 | import MultipeerConnectivity 10 | 11 | func join(_ args: Any...) -> String { 12 | args.map(String.init(describing:)).joined(separator: ",") 13 | } 14 | 15 | class ViewController: UIViewController { 16 | @IBOutlet weak var tableView: UITableView! 17 | 18 | var messages: [String] = [] 19 | var serviceType: String { "bannzai-p2p" } 20 | var connectedPeerIDs: [MCPeerID] = [] 21 | 22 | let peerID = MCPeerID(displayName: UUID().uuidString) 23 | lazy var session: MCSession = { 24 | let session = MCSession(peer: peerID) 25 | return session 26 | }() 27 | lazy var advertiser: MCNearbyServiceAdvertiser = { 28 | let advertiser = MCNearbyServiceAdvertiser(peer: peerID, discoveryInfo: nil, serviceType: serviceType) 29 | return advertiser 30 | }() 31 | 32 | override func viewDidLoad() { 33 | super.viewDidLoad() 34 | 35 | messages.append("me: \(peerID.displayName)") 36 | tableView.delegate = self 37 | tableView.dataSource = self 38 | tableView.register(TableViewCell.classForCoder(), forCellReuseIdentifier: "TableViewCell") 39 | 40 | session.delegate = self 41 | advertiser.delegate = self 42 | advertiser.startAdvertisingPeer() 43 | } 44 | 45 | override func viewWillAppear(_ animated: Bool) { 46 | super.viewWillAppear(animated) 47 | navigationItem.rightBarButtonItems = [ 48 | .init(title: "Browse", style: .plain, target: self, action: #selector(browseButtonPressed)), 49 | .init(title: "Send", style: .plain, target: self, action: #selector(sendButtonPressed)), 50 | ] 51 | tableView.reloadData() 52 | } 53 | 54 | @objc func sendButtonPressed() { 55 | if connectedPeerIDs.isEmpty { 56 | return 57 | } 58 | let image = UIImage(named: "bannzai")! 59 | do { 60 | try session.send( 61 | image.jpegData(compressionQuality: 0.5)!, 62 | toPeers: connectedPeerIDs, 63 | with: .reliable 64 | ) 65 | } catch { 66 | print(error) 67 | } 68 | } 69 | 70 | @objc func browseButtonPressed() { 71 | let browserViewController: MCBrowserViewController = .init(serviceType: serviceType, session: session) 72 | browserViewController.delegate = self 73 | present(browserViewController, animated: true, completion: nil) 74 | } 75 | } 76 | 77 | extension ViewController: UITableViewDataSource, UITableViewDelegate { 78 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 79 | messages.count 80 | } 81 | 82 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 83 | let cell = tableView.dequeueReusableCell(withIdentifier: "TableViewCell", for: indexPath) 84 | cell.textLabel?.text = messages[indexPath.row] 85 | return cell 86 | } 87 | } 88 | 89 | extension ViewController: MCSessionDelegate { 90 | func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState) { 91 | DispatchQueue.main.async { 92 | print(#function, peerID, state.rawValue) 93 | self.messages.append(join(#function, peerID, state.rawValue)) 94 | self.tableView.reloadData() 95 | } 96 | switch state { 97 | case .notConnected: 98 | connectedPeerIDs.removeAll() 99 | case .connecting: 100 | break 101 | case .connected: 102 | connectedPeerIDs.append(peerID) 103 | @unknown default: 104 | fatalError("unexpected state \(state.rawValue)") 105 | } 106 | } 107 | 108 | func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID) { 109 | DispatchQueue.main.async { 110 | print(#function, data, peerID) 111 | self.messages.append(join(#function, data, peerID)) 112 | self.tableView.reloadData() 113 | } 114 | 115 | DispatchQueue.main.async { 116 | let image = UIImage(data: data) 117 | let imageView = UIImageView(image: image) 118 | imageView.center = self.view.center 119 | self.view.addSubview(imageView) 120 | 121 | DispatchQueue.main.asyncAfter(deadline: .now() + 2) { 122 | imageView.removeFromSuperview() 123 | } 124 | } 125 | } 126 | 127 | func session(_ session: MCSession, didReceive stream: InputStream, withName streamName: String, fromPeer peerID: MCPeerID) { 128 | DispatchQueue.main.async { 129 | print(#function, stream, streamName, peerID) 130 | self.messages.append(join(#function, stream, streamName, peerID)) 131 | self.tableView.reloadData() 132 | } 133 | } 134 | 135 | func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, with progress: Progress) { 136 | DispatchQueue.main.async { 137 | print(#function, resourceName, peerID, progress) 138 | self.messages.append(join(#function, resourceName, peerID, progress)) 139 | self.tableView.reloadData() 140 | } 141 | } 142 | 143 | func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL?, withError error: Error?) { 144 | DispatchQueue.main.async { 145 | print(#function, resourceName, peerID, String(describing: localURL), String(describing: error)) 146 | self.messages.append(join(#function, resourceName, peerID, String(describing: localURL), String(describing: error))) 147 | self.tableView.reloadData() 148 | } 149 | } 150 | 151 | func session(_ session: MCSession, didReceiveCertificate certificate: [Any]?, fromPeer peerID: MCPeerID, certificateHandler: @escaping (Bool) -> Void) { 152 | DispatchQueue.main.async { 153 | print(#function, String(describing: certificate), peerID) 154 | self.messages.append(join(#function, String(describing: certificate), peerID)) 155 | self.tableView.reloadData() 156 | certificateHandler(true) 157 | } 158 | } 159 | } 160 | 161 | extension ViewController: MCNearbyServiceAdvertiserDelegate { 162 | func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didNotStartAdvertisingPeer error: Error) { 163 | 164 | } 165 | func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didReceiveInvitationFromPeer peerID: MCPeerID, withContext context: Data?, invitationHandler: @escaping (Bool, MCSession?) -> Void) { 166 | print(#function) 167 | invitationHandler(true, session) 168 | DispatchQueue.main.async { 169 | self.messages.append(#function) 170 | } 171 | } 172 | } 173 | 174 | extension ViewController: MCBrowserViewControllerDelegate { 175 | func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) { 176 | print(#function) 177 | messages.append((#function)) 178 | tableView.reloadData() 179 | dismiss(animated: true, completion: nil) 180 | } 181 | 182 | func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) { 183 | print(#function) 184 | browserViewController.dismiss(animated: true, completion: nil) 185 | messages.append((#function)) 186 | tableView.reloadData() 187 | } 188 | func browserViewController(_ browserViewController: MCBrowserViewController, shouldPresentNearbyPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?) -> Bool { 189 | DispatchQueue.main.async { 190 | print(#function, peerID, String(describing: info)) 191 | self.messages.append(join(#function, peerID, String(describing: info))) 192 | self.tableView.reloadData() 193 | } 194 | return true 195 | } 196 | } 197 | 198 | final class TableViewCell: UITableViewCell { 199 | 200 | } 201 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemoTests/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 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemoTests/MultipeerConnectiveDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MultipeerConnectiveDemoTests.swift 3 | // MultipeerConnectiveDemoTests 4 | // 5 | // Created by Yudai.Hirose on 2021/03/19. 6 | // 7 | 8 | import XCTest 9 | @testable import MultipeerConnectiveDemo 10 | 11 | class MultipeerConnectiveDemoTests: XCTestCase { 12 | 13 | override func setUpWithError() throws { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | } 16 | 17 | override func tearDownWithError() throws { 18 | // Put teardown code here. This method is called after the invocation of each test method in the class. 19 | } 20 | 21 | func testExample() throws { 22 | // This is an example of a functional test case. 23 | // Use XCTAssert and related functions to verify your tests produce the correct results. 24 | } 25 | 26 | func testPerformanceExample() throws { 27 | // This is an example of a performance test case. 28 | self.measure { 29 | // Put the code you want to measure the time of here. 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemoUITests/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 | -------------------------------------------------------------------------------- /MultipeerConnectiveDemoUITests/MultipeerConnectiveDemoUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MultipeerConnectiveDemoUITests.swift 3 | // MultipeerConnectiveDemoUITests 4 | // 5 | // Created by Yudai.Hirose on 2021/03/19. 6 | // 7 | 8 | import XCTest 9 | 10 | class MultipeerConnectiveDemoUITests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | 15 | // In UI tests it is usually best to stop immediately when a failure occurs. 16 | continueAfterFailure = false 17 | 18 | // 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. 19 | } 20 | 21 | override func tearDownWithError() throws { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | func testExample() throws { 26 | // UI tests must launch the application that they test. 27 | let app = XCUIApplication() 28 | app.launch() 29 | 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 | func testLaunchPerformance() throws { 35 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 36 | // This measures how long it takes to launch your application. 37 | measure(metrics: [XCTApplicationLaunchMetric()]) { 38 | XCUIApplication().launch() 39 | } 40 | } 41 | } 42 | } 43 | --------------------------------------------------------------------------------