From baa67f0eeea4463057d5301b0e9ba3a1b14801fb Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 3 Jun 2019 18:23:21 +0200 Subject: [PATCH 1/3] Add TestsApplication for running Unit Tests on real devices. --- DeviceKit.xcodeproj/project.pbxproj | 268 +++++++++++++++++- TestsApplication/AppDelegate.swift | 20 ++ .../AppIcon.appiconset/Contents.json | 98 +++++++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 ++ TestsApplication/Base.lproj/Main.storyboard | 40 +++ TestsApplication/Info.plist | 45 +++ TestsApplication/ViewController.swift | 17 ++ 8 files changed, 512 insertions(+), 7 deletions(-) create mode 100644 TestsApplication/AppDelegate.swift create mode 100644 TestsApplication/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 TestsApplication/Assets.xcassets/Contents.json create mode 100644 TestsApplication/Base.lproj/LaunchScreen.storyboard create mode 100644 TestsApplication/Base.lproj/Main.storyboard create mode 100644 TestsApplication/Info.plist create mode 100644 TestsApplication/ViewController.swift diff --git a/DeviceKit.xcodeproj/project.pbxproj b/DeviceKit.xcodeproj/project.pbxproj index 5fe48e93..04c1b1eb 100644 --- a/DeviceKit.xcodeproj/project.pbxproj +++ b/DeviceKit.xcodeproj/project.pbxproj @@ -24,6 +24,13 @@ 6D29C0C01F122C7A005B52BD /* Device.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D29C0BF1F122C77005B52BD /* Device.generated.swift */; }; 955EE5A31D5E581B008C3DA8 /* DeviceKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 955EE59A1D5E581B008C3DA8 /* DeviceKit.framework */; }; 955EE5B41D5E5A90008C3DA8 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C7E8451C61253900B0189E /* Tests.swift */; }; + FC5F919622A5764E007FFC64 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC5F919522A5764E007FFC64 /* AppDelegate.swift */; }; + FC5F919822A5764E007FFC64 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC5F919722A5764E007FFC64 /* ViewController.swift */; }; + FC5F919B22A5764E007FFC64 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FC5F919922A5764E007FFC64 /* Main.storyboard */; }; + FC5F919D22A57651007FFC64 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FC5F919C22A57651007FFC64 /* Assets.xcassets */; }; + FC5F91A022A57651007FFC64 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FC5F919E22A57651007FFC64 /* LaunchScreen.storyboard */; }; + FC5F91AE22A578BF007FFC64 /* DeviceKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 955EE59A1D5E581B008C3DA8 /* DeviceKit.framework */; }; + FC5F91AF22A578BF007FFC64 /* DeviceKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 955EE59A1D5E581B008C3DA8 /* DeviceKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -34,8 +41,36 @@ remoteGlobalIDString = 955EE5991D5E581B008C3DA8; remoteInfo = DeviceKit; }; + FC5F91A522A576C0007FFC64 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 95CBDB641BFD2B440065FC66 /* Project object */; + proxyType = 1; + remoteGlobalIDString = FC5F919222A5764E007FFC64; + remoteInfo = TestsApplication; + }; + FC5F91B022A578BF007FFC64 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 95CBDB641BFD2B440065FC66 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 955EE5991D5E581B008C3DA8; + remoteInfo = DeviceKit; + }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + FC5F91B222A578BF007FFC64 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + FC5F91AF22A578BF007FFC64 /* DeviceKit.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 6D29C0BC1F122863005B52BD /* Device.swift.gyb */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; lineEnding = 0; name = Device.swift.gyb; path = Source/Device.swift.gyb; sourceTree = ""; }; 6D29C0BF1F122C77005B52BD /* Device.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Device.generated.swift; path = Source/Device.generated.swift; sourceTree = ""; }; @@ -56,6 +91,13 @@ 95C7E8471C612ABA00B0189E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Tests/Info.plist; sourceTree = ""; }; 95C7E84D1C6130DB00B0189E /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = ""; }; 95C7E84E1C61332300B0189E /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; + FC5F919322A5764E007FFC64 /* TestsApplication.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestsApplication.app; sourceTree = BUILT_PRODUCTS_DIR; }; + FC5F919522A5764E007FFC64 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + FC5F919722A5764E007FFC64 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + FC5F919A22A5764E007FFC64 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + FC5F919C22A57651007FFC64 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + FC5F919F22A57651007FFC64 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + FC5F91A122A57651007FFC64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -74,6 +116,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FC5F919022A5764E007FFC64 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FC5F91AE22A578BF007FFC64 /* DeviceKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -118,6 +168,7 @@ children = ( 95C7E83B1C6122BF00B0189E /* Source */, 95C7E8411C61241200B0189E /* Tests */, + FC5F919422A5764E007FFC64 /* TestsApplication */, 954977F91E748DB000D6FAEB /* Scripts */, 957D18251C28C1E90067D203 /* README.md */, 95C7E84E1C61332300B0189E /* Package.swift */, @@ -130,6 +181,7 @@ 95C7E83F1C61239D00B0189E /* .gitignore */, 6D9B30FB1F1A2DC50008F7E0 /* Utils */, 95CBDB701BFD2B5F0065FC66 /* Products */, + FC5F91A722A5785D007FFC64 /* Frameworks */, ); indentWidth = 2; sourceTree = ""; @@ -141,10 +193,31 @@ children = ( 955EE59A1D5E581B008C3DA8 /* DeviceKit.framework */, 955EE5A21D5E581B008C3DA8 /* DeviceKitTests.xctest */, + FC5F919322A5764E007FFC64 /* TestsApplication.app */, ); name = Products; sourceTree = ""; }; + FC5F919422A5764E007FFC64 /* TestsApplication */ = { + isa = PBXGroup; + children = ( + FC5F919522A5764E007FFC64 /* AppDelegate.swift */, + FC5F919722A5764E007FFC64 /* ViewController.swift */, + FC5F919922A5764E007FFC64 /* Main.storyboard */, + FC5F919C22A57651007FFC64 /* Assets.xcassets */, + FC5F919E22A57651007FFC64 /* LaunchScreen.storyboard */, + FC5F91A122A57651007FFC64 /* Info.plist */, + ); + path = TestsApplication; + sourceTree = ""; + }; + FC5F91A722A5785D007FFC64 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -189,19 +262,39 @@ ); dependencies = ( 955EE5A51D5E581B008C3DA8 /* PBXTargetDependency */, + FC5F91A622A576C0007FFC64 /* PBXTargetDependency */, ); name = DeviceKitTests; productName = DeviceKitTests; productReference = 955EE5A21D5E581B008C3DA8 /* DeviceKitTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + FC5F919222A5764E007FFC64 /* TestsApplication */ = { + isa = PBXNativeTarget; + buildConfigurationList = FC5F91A222A57651007FFC64 /* Build configuration list for PBXNativeTarget "TestsApplication" */; + buildPhases = ( + FC5F918F22A5764E007FFC64 /* Sources */, + FC5F919022A5764E007FFC64 /* Frameworks */, + FC5F919122A5764E007FFC64 /* Resources */, + FC5F91B222A578BF007FFC64 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + FC5F91B122A578BF007FFC64 /* PBXTargetDependency */, + ); + name = TestsApplication; + productName = TestsApplication; + productReference = FC5F919322A5764E007FFC64 /* TestsApplication.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 95CBDB641BFD2B440065FC66 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0800; + LastSwiftUpdateCheck = 1020; LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Dennis Weissmann"; TargetAttributes = { @@ -217,6 +310,10 @@ CreatedOnToolsVersion = 8.0; LastSwiftMigration = 1020; ProvisioningStyle = Automatic; + TestTargetID = FC5F919222A5764E007FFC64; + }; + FC5F919222A5764E007FFC64 = { + CreatedOnToolsVersion = 10.2.1; }; }; }; @@ -227,6 +324,7 @@ knownRegions = ( English, en, + Base, ); mainGroup = 95CBDB631BFD2B440065FC66; productRefGroup = 95CBDB701BFD2B5F0065FC66 /* Products */; @@ -236,6 +334,7 @@ 955EE5991D5E581B008C3DA8 /* DeviceKit */, 955EE5A11D5E581B008C3DA8 /* DeviceKitTests */, 6D7666191F1A083200F59630 /* Run SwiftLint */, + FC5F919222A5764E007FFC64 /* TestsApplication */, ); }; /* End PBXProject section */ @@ -255,6 +354,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FC5F919122A5764E007FFC64 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FC5F91A022A57651007FFC64 /* LaunchScreen.storyboard in Resources */, + FC5F919D22A57651007FFC64 /* Assets.xcassets in Resources */, + FC5F919B22A5764E007FFC64 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -307,6 +416,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FC5F918F22A5764E007FFC64 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FC5F919822A5764E007FFC64 /* ViewController.swift in Sources */, + FC5F919622A5764E007FFC64 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -315,8 +433,37 @@ target = 955EE5991D5E581B008C3DA8 /* DeviceKit */; targetProxy = 955EE5A41D5E581B008C3DA8 /* PBXContainerItemProxy */; }; + FC5F91A622A576C0007FFC64 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = FC5F919222A5764E007FFC64 /* TestsApplication */; + targetProxy = FC5F91A522A576C0007FFC64 /* PBXContainerItemProxy */; + }; + FC5F91B122A578BF007FFC64 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 955EE5991D5E581B008C3DA8 /* DeviceKit */; + targetProxy = FC5F91B022A578BF007FFC64 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + FC5F919922A5764E007FFC64 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FC5F919A22A5764E007FFC64 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + FC5F919E22A57651007FFC64 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FC5F919F22A57651007FFC64 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 6D76661B1F1A083300F59630 /* Debug */ = { isa = XCBuildConfiguration; @@ -350,13 +497,13 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVES = YES; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3M5P376P9C; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -410,13 +557,13 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVES = YES; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3M5P376P9C; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -453,6 +600,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -463,10 +611,11 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = SWR98KT795; + DEVELOPMENT_TEAM = 3M5P376P9C; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -491,6 +640,7 @@ SWIFT_OBJC_INTERFACE_HEADER_NAME = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestsApplication.app/TestsApplication"; }; name = Debug; }; @@ -499,6 +649,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -509,10 +660,11 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = SWR98KT795; + DEVELOPMENT_TEAM = 3M5P376P9C; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -532,6 +684,7 @@ SWIFT_OBJC_INTERFACE_HEADER_NAME = ""; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestsApplication.app/TestsApplication"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -620,6 +773,98 @@ }; name = Release; }; + FC5F91A322A57651007FFC64 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = 3M5P376P9C; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INFOPLIST_FILE = TestsApplication/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = me.dennisweissmann.DeviceKit.TestsApplication; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + FC5F91A422A57651007FFC64 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = 3M5P376P9C; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INFOPLIST_FILE = TestsApplication/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = me.dennisweissmann.DeviceKit.TestsApplication; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -659,6 +904,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FC5F91A222A57651007FFC64 /* Build configuration list for PBXNativeTarget "TestsApplication" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FC5F91A322A57651007FFC64 /* Debug */, + FC5F91A422A57651007FFC64 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 95CBDB641BFD2B440065FC66 /* Project object */; diff --git a/TestsApplication/AppDelegate.swift b/TestsApplication/AppDelegate.swift new file mode 100644 index 00000000..a61d415c --- /dev/null +++ b/TestsApplication/AppDelegate.swift @@ -0,0 +1,20 @@ +// +// AppDelegate.swift +// TestsApplication +// +// Created by Zandor Smith on 03/06/2019. +// Copyright © 2019 Dennis Weissmann. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + return true + } + +} diff --git a/TestsApplication/Assets.xcassets/AppIcon.appiconset/Contents.json b/TestsApplication/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/TestsApplication/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TestsApplication/Assets.xcassets/Contents.json b/TestsApplication/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/TestsApplication/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TestsApplication/Base.lproj/LaunchScreen.storyboard b/TestsApplication/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/TestsApplication/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestsApplication/Base.lproj/Main.storyboard b/TestsApplication/Base.lproj/Main.storyboard new file mode 100644 index 00000000..45b1dbfc --- /dev/null +++ b/TestsApplication/Base.lproj/Main.storyboard @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestsApplication/Info.plist b/TestsApplication/Info.plist new file mode 100644 index 00000000..16be3b68 --- /dev/null +++ b/TestsApplication/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/TestsApplication/ViewController.swift b/TestsApplication/ViewController.swift new file mode 100644 index 00000000..d83445fa --- /dev/null +++ b/TestsApplication/ViewController.swift @@ -0,0 +1,17 @@ +// +// ViewController.swift +// TestsApplication +// +// Created by Zandor Smith on 03/06/2019. +// Copyright © 2019 Dennis Weissmann. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + } + +} From 1b28a8287aae41c3f97d5f467ff944bdc76c8ee8 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 3 Jun 2019 18:23:40 +0200 Subject: [PATCH 2/3] Fix Unit Tests so they also succeed when running them on a real device. --- Tests/Tests.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 330c21b1..4edafff0 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -17,11 +17,17 @@ class DeviceKitTests: XCTestCase { let device = Device.current func testDeviceSimulator() { - XCTAssertTrue(device.isOneOf(Device.allSimulators)) + if Device.current.isSimulator { + XCTAssertTrue(device.isOneOf(Device.allSimulators)) + } else { + XCTAssertFalse(device.isOneOf(Device.allSimulators)) + } } func testDeviceDescription() { - XCTAssertTrue(device.description.hasPrefix("Simulator")) + if Device.current.isSimulator { + XCTAssertTrue(device.description.hasPrefix("Simulator")) + } XCTAssertTrue(device.description.contains("iPhone") || device.description.contains("iPad") || device.description.contains("iPod") @@ -31,7 +37,11 @@ class DeviceKitTests: XCTestCase { // MARK: - iOS #if os(iOS) func testIsSimulator() { + #if targetEnvironment(simulator) XCTAssertTrue(device.isSimulator) + #else + XCTAssertFalse(device.isSimulator) + #endif } func testIsPhoneIsPad() { From 5d1a9d78cfdf9d20bf4386a662105fd08f9c6675 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 3 Jun 2019 18:28:05 +0200 Subject: [PATCH 3/3] Use the existing device variable. --- Tests/Tests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 4edafff0..2edb594c 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -17,7 +17,7 @@ class DeviceKitTests: XCTestCase { let device = Device.current func testDeviceSimulator() { - if Device.current.isSimulator { + if device.isSimulator { XCTAssertTrue(device.isOneOf(Device.allSimulators)) } else { XCTAssertFalse(device.isOneOf(Device.allSimulators)) @@ -25,7 +25,7 @@ class DeviceKitTests: XCTestCase { } func testDeviceDescription() { - if Device.current.isSimulator { + if device.isSimulator { XCTAssertTrue(device.description.hasPrefix("Simulator")) } XCTAssertTrue(device.description.contains("iPhone")