From 62cc40c46017de6ea1a640b527aae992505ebef4 Mon Sep 17 00:00:00 2001 From: Lammert Westerhoff Date: Tue, 28 Aug 2018 13:20:59 +0200 Subject: [PATCH 1/4] Add basic watchOS support --- R.swift.Library.podspec | 5 +- R.swift.Library.xcodeproj/project.pbxproj | 174 ++++++++++++++++++++++ Rswift-watchOS/Info.plist | 22 +++ Rswift-watchOS/Rswift_watchOS.h | 19 +++ 4 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 Rswift-watchOS/Info.plist create mode 100644 Rswift-watchOS/Rswift_watchOS.h diff --git a/R.swift.Library.podspec b/R.swift.Library.podspec index cdecc5e..abd2e33 100644 --- a/R.swift.Library.podspec +++ b/R.swift.Library.podspec @@ -19,9 +19,12 @@ Pod::Spec.new do |spec| spec.source = { :git => "https://github.com/mac-cain13/R.swift.Library.git", :tag => "v#{spec.version}" } spec.ios.deployment_target = '8.0' + spec.ios.source_files = "Library/**/*.swift" spec.tvos.deployment_target = '9.0' + spec.tvos.source_files = "Library/**/*.swift" + spec.watchos.deployment_target = '2.2' + spec.watchos.source_files = ["Library/Core/*.swift", "Library/Foundation/*.swift"] spec.module_name = "Rswift" - spec.source_files = "Library/**/*.swift" end diff --git a/R.swift.Library.xcodeproj/project.pbxproj b/R.swift.Library.xcodeproj/project.pbxproj index 8c5a44d..92ae2c8 100644 --- a/R.swift.Library.xcodeproj/project.pbxproj +++ b/R.swift.Library.xcodeproj/project.pbxproj @@ -7,6 +7,24 @@ objects = { /* Begin PBXBuildFile section */ + 2F5FBC4421355A1400A83A69 /* Rswift_watchOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F5FBC4221355A1400A83A69 /* Rswift_watchOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2F5FBC4821355AC400A83A69 /* ColorResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E22D43661C95EEA100692FFF /* ColorResource.swift */; }; + 2F5FBC4A21355ADB00A83A69 /* Bundle+FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D56DC7721C42B65C00623437 /* Bundle+FileResource.swift */; }; + 2F5FBC4B21355ADB00A83A69 /* Data+FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E20F34A61C92B44100338F81 /* Data+FileResource.swift */; }; + 2F5FBC4C21355ADF00A83A69 /* FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E435AC1C3D00770091090C /* FileResource.swift */; }; + 2F5FBC4D21355ADF00A83A69 /* FontResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57E1EB21C3D762300DDA68F /* FontResource.swift */; }; + 2F5FBC4E21355ADF00A83A69 /* Identifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D543F9BA1C1497EB00D16A0C /* Identifier.swift */; }; + 2F5FBC4F21355ADF00A83A69 /* ImageResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D553F5841C44157000885232 /* ImageResource.swift */; }; + 2F5FBC5021355ADF00A83A69 /* NibResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D543F9C01C14984300D16A0C /* NibResource.swift */; }; + 2F5FBC5121355ADF00A83A69 /* ReuseIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D543F9BC1C14980600D16A0C /* ReuseIdentifierProtocol.swift */; }; + 2F5FBC5221355ADF00A83A69 /* StoryboardResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57E1EB61C3E482A00DDA68F /* StoryboardResource.swift */; }; + 2F5FBC5321355ADF00A83A69 /* StoryboardSegueIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D543F9BE1C14983100D16A0C /* StoryboardSegueIdentifierProtocol.swift */; }; + 2F5FBC5421355ADF00A83A69 /* StoryboardViewControllerResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D51335261C959DF20014C9D4 /* StoryboardViewControllerResource.swift */; }; + 2F5FBC5521355ADF00A83A69 /* StringResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E250BE961CCBF60300CC71DE /* StringResource.swift */; }; + 2F5FBC5621355ADF00A83A69 /* Validatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53F19231C229D7200AE2FAD /* Validatable.swift */; }; + 2F5FBC5821355B0200A83A69 /* UIColor+ColorResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2CA68EE1EE75992009C4DB4 /* UIColor+ColorResource.swift */; }; + 2F5FBC5921355B0200A83A69 /* UIFont+FontResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57E1EB41C3D774000DDA68F /* UIFont+FontResource.swift */; }; + 2F5FBC5A21355B0200A83A69 /* UIImage+ImageResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D553F5861C44170E00885232 /* UIImage+ImageResource.swift */; }; 806E699C1C42BD9C00DE3A8B /* Rswift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 806E69921C42BD9C00DE3A8B /* Rswift.framework */; }; 806E69A91C42BDDA00DE3A8B /* FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E435AC1C3D00770091090C /* FileResource.swift */; }; 806E69AA1C42BDDA00DE3A8B /* FontResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57E1EB21C3D762300DDA68F /* FontResource.swift */; }; @@ -87,6 +105,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 2F5FBC4021355A1400A83A69 /* Rswift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Rswift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2F5FBC4221355A1400A83A69 /* Rswift_watchOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Rswift_watchOS.h; sourceTree = ""; }; + 2F5FBC4321355A1400A83A69 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 806E69921C42BD9C00DE3A8B /* Rswift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Rswift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 806E699B1C42BD9C00DE3A8B /* RswiftTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RswiftTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; D51335261C959DF20014C9D4 /* StoryboardViewControllerResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardViewControllerResource.swift; sourceTree = ""; }; @@ -125,6 +146,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 2F5FBC3D21355A1400A83A69 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 806E698E1C42BD9C00DE3A8B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -158,6 +186,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2F5FBC4121355A1400A83A69 /* Rswift-watchOS */ = { + isa = PBXGroup; + children = ( + 2F5FBC4221355A1400A83A69 /* Rswift_watchOS.h */, + 2F5FBC4321355A1400A83A69 /* Info.plist */, + ); + path = "Rswift-watchOS"; + sourceTree = ""; + }; D543F9C21C14987000D16A0C /* UIKit */ = { isa = PBXGroup; children = ( @@ -211,6 +248,7 @@ children = ( D59246501C117A55007F94C7 /* Library */, D592465C1C117A55007F94C7 /* LibraryTests */, + 2F5FBC4121355A1400A83A69 /* Rswift-watchOS */, D592464F1C117A55007F94C7 /* Products */, ); indentWidth = 2; @@ -225,6 +263,7 @@ D59246581C117A55007F94C7 /* RswiftTests-iOS.xctest */, 806E69921C42BD9C00DE3A8B /* Rswift.framework */, 806E699B1C42BD9C00DE3A8B /* RswiftTests-tvOS.xctest */, + 2F5FBC4021355A1400A83A69 /* Rswift.framework */, ); name = Products; sourceTree = ""; @@ -253,6 +292,14 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 2F5FBC3B21355A1400A83A69 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2F5FBC4421355A1400A83A69 /* Rswift_watchOS.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 806E698F1C42BD9C00DE3A8B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -272,6 +319,24 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 2F5FBC3F21355A1400A83A69 /* Rswift-watchOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2F5FBC4721355A1400A83A69 /* Build configuration list for PBXNativeTarget "Rswift-watchOS" */; + buildPhases = ( + 2F5FBC3B21355A1400A83A69 /* Headers */, + 2F5FBC3C21355A1400A83A69 /* Sources */, + 2F5FBC3D21355A1400A83A69 /* Frameworks */, + 2F5FBC3E21355A1400A83A69 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Rswift-watchOS"; + productName = "Rswift-watchOS"; + productReference = 2F5FBC4021355A1400A83A69 /* Rswift.framework */; + productType = "com.apple.product-type.framework"; + }; 806E69911C42BD9C00DE3A8B /* Rswift-tvOS */ = { isa = PBXNativeTarget; buildConfigurationList = 806E69A31C42BD9C00DE3A8B /* Build configuration list for PBXNativeTarget "Rswift-tvOS" */; @@ -354,6 +419,10 @@ LastUpgradeCheck = 1000; ORGANIZATIONNAME = "Mathijs Kadijk"; TargetAttributes = { + 2F5FBC3F21355A1400A83A69 = { + CreatedOnToolsVersion = 10.0; + ProvisioningStyle = Automatic; + }; 806E69911C42BD9C00DE3A8B = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0900; @@ -388,11 +457,19 @@ D59246571C117A55007F94C7 /* RswiftTests-iOS */, 806E69911C42BD9C00DE3A8B /* Rswift-tvOS */, 806E699A1C42BD9C00DE3A8B /* RswiftTests-tvOS */, + 2F5FBC3F21355A1400A83A69 /* Rswift-watchOS */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 2F5FBC3E21355A1400A83A69 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 806E69901C42BD9C00DE3A8B /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -424,6 +501,30 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 2F5FBC3C21355A1400A83A69 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2F5FBC4F21355ADF00A83A69 /* ImageResource.swift in Sources */, + 2F5FBC5421355ADF00A83A69 /* StoryboardViewControllerResource.swift in Sources */, + 2F5FBC4D21355ADF00A83A69 /* FontResource.swift in Sources */, + 2F5FBC5A21355B0200A83A69 /* UIImage+ImageResource.swift in Sources */, + 2F5FBC5921355B0200A83A69 /* UIFont+FontResource.swift in Sources */, + 2F5FBC4821355AC400A83A69 /* ColorResource.swift in Sources */, + 2F5FBC4C21355ADF00A83A69 /* FileResource.swift in Sources */, + 2F5FBC5221355ADF00A83A69 /* StoryboardResource.swift in Sources */, + 2F5FBC5521355ADF00A83A69 /* StringResource.swift in Sources */, + 2F5FBC4B21355ADB00A83A69 /* Data+FileResource.swift in Sources */, + 2F5FBC5021355ADF00A83A69 /* NibResource.swift in Sources */, + 2F5FBC5321355ADF00A83A69 /* StoryboardSegueIdentifierProtocol.swift in Sources */, + 2F5FBC4E21355ADF00A83A69 /* Identifier.swift in Sources */, + 2F5FBC4A21355ADB00A83A69 /* Bundle+FileResource.swift in Sources */, + 2F5FBC5821355B0200A83A69 /* UIColor+ColorResource.swift in Sources */, + 2F5FBC5121355ADF00A83A69 /* ReuseIdentifierProtocol.swift in Sources */, + 2F5FBC5621355ADF00A83A69 /* Validatable.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 806E698D1C42BD9C00DE3A8B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -524,6 +625,70 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 2F5FBC4521355A1400A83A69 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "Rswift-watchOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.rswift.library; + PRODUCT_NAME = Rswift; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 2.2; + }; + name = Debug; + }; + 2F5FBC4621355A1400A83A69 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "Rswift-watchOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.rswift.library; + PRODUCT_NAME = Rswift; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 2.2; + }; + name = Release; + }; 806E69A41C42BD9C00DE3A8B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -772,6 +937,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 2F5FBC4721355A1400A83A69 /* Build configuration list for PBXNativeTarget "Rswift-watchOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2F5FBC4521355A1400A83A69 /* Debug */, + 2F5FBC4621355A1400A83A69 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 806E69A31C42BD9C00DE3A8B /* Build configuration list for PBXNativeTarget "Rswift-tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Rswift-watchOS/Info.plist b/Rswift-watchOS/Info.plist new file mode 100644 index 0000000..e1fe4cf --- /dev/null +++ b/Rswift-watchOS/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/Rswift-watchOS/Rswift_watchOS.h b/Rswift-watchOS/Rswift_watchOS.h new file mode 100644 index 0000000..5b0a159 --- /dev/null +++ b/Rswift-watchOS/Rswift_watchOS.h @@ -0,0 +1,19 @@ +// +// Rswift_watchOS.h +// Rswift-watchOS +// +// Created by Lammert Westerhoff on 28/08/2018. +// Copyright © 2018 Mathijs Kadijk. All rights reserved. +// + +#import + +//! Project version number for Rswift_watchOS. +FOUNDATION_EXPORT double Rswift_watchOSVersionNumber; + +//! Project version string for Rswift_watchOS. +FOUNDATION_EXPORT const unsigned char Rswift_watchOSVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + From d6eba6f7f42ac5a10c73309f1ed63f43f42af38c Mon Sep 17 00:00:00 2001 From: Lammert Westerhoff Date: Mon, 14 Jan 2019 16:37:08 +0100 Subject: [PATCH 2/4] Fix code for different platforms --- Library/UIKit/UIColor+ColorResource.swift | 17 +++++++++++++++++ Library/UIKit/UIImage+ImageResource.swift | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/Library/UIKit/UIColor+ColorResource.swift b/Library/UIKit/UIColor+ColorResource.swift index 800d338..f585de0 100644 --- a/Library/UIKit/UIColor+ColorResource.swift +++ b/Library/UIKit/UIColor+ColorResource.swift @@ -12,6 +12,8 @@ import UIKit @available(iOS 11.0, *) @available(tvOS 11.0, *) public extension UIColor { + + #if os(iOS) || os(tvOS) /** Returns the color from this resource (R.color.*) that is compatible with the trait collection. @@ -23,4 +25,19 @@ public extension UIColor { public convenience init?(resource: ColorResourceType, compatibleWith traitCollection: UITraitCollection? = nil) { self.init(named: resource.name, in: resource.bundle, compatibleWith: traitCollection) } + #endif + + #if os(watchOS) + /** + Returns the color from this resource (R.color.*) that is compatible with the trait collection. + + - parameter resource: The resource you want the image of (R.color.*) + + - returns: A color that exactly or best matches the desired traits with the given resource (R.color.*), or nil if no suitable color was found. + */ + @available(watchOSApplicationExtension 4.0, *) + public convenience init?(resource: ColorResourceType) { + self.init(named: resource.name) + } + #endif } diff --git a/Library/UIKit/UIImage+ImageResource.swift b/Library/UIKit/UIImage+ImageResource.swift index 6037b4f..5f3daa9 100644 --- a/Library/UIKit/UIImage+ImageResource.swift +++ b/Library/UIKit/UIImage+ImageResource.swift @@ -10,6 +10,8 @@ import UIKit public extension UIImage { + + #if os(iOS) || os(tvOS) /** Returns the image from this resource (R.image.*) that is compatible with the trait collection. @@ -21,4 +23,18 @@ public extension UIImage { public convenience init?(resource: ImageResourceType, compatibleWith traitCollection: UITraitCollection? = nil) { self.init(named: resource.name, in: resource.bundle, compatibleWith: traitCollection) } + #endif + + #if os(watchOS) + /** + Returns the image from this resource (R.image.*) that is compatible with the trait collection. + + - parameter resource: The resource you want the image of (R.image.*) + + - returns: An image that exactly or best matches the desired traits with the given resource (R.image.*), or nil if no suitable image was found. + */ + public convenience init?(resource: ImageResourceType) { + self.init(named: resource.name) + } + #endif } From c6ba2bced38a235aaae53066a898e5580000f767 Mon Sep 17 00:00:00 2001 From: Tom Lokhorst Date: Mon, 14 Jan 2019 17:36:22 +0100 Subject: [PATCH 3/4] Remove Rswift-watchOS target files, use shared Info.plist file --- R.swift.Library.xcodeproj/project.pbxproj | 18 ++---------------- Rswift-watchOS/Info.plist | 22 ---------------------- Rswift-watchOS/Rswift_watchOS.h | 19 ------------------- 3 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 Rswift-watchOS/Info.plist delete mode 100644 Rswift-watchOS/Rswift_watchOS.h diff --git a/R.swift.Library.xcodeproj/project.pbxproj b/R.swift.Library.xcodeproj/project.pbxproj index 92ae2c8..bd72db7 100644 --- a/R.swift.Library.xcodeproj/project.pbxproj +++ b/R.swift.Library.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 2F5FBC4421355A1400A83A69 /* Rswift_watchOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F5FBC4221355A1400A83A69 /* Rswift_watchOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2F5FBC4821355AC400A83A69 /* ColorResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E22D43661C95EEA100692FFF /* ColorResource.swift */; }; 2F5FBC4A21355ADB00A83A69 /* Bundle+FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D56DC7721C42B65C00623437 /* Bundle+FileResource.swift */; }; 2F5FBC4B21355ADB00A83A69 /* Data+FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E20F34A61C92B44100338F81 /* Data+FileResource.swift */; }; @@ -106,8 +105,6 @@ /* Begin PBXFileReference section */ 2F5FBC4021355A1400A83A69 /* Rswift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Rswift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2F5FBC4221355A1400A83A69 /* Rswift_watchOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Rswift_watchOS.h; sourceTree = ""; }; - 2F5FBC4321355A1400A83A69 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 806E69921C42BD9C00DE3A8B /* Rswift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Rswift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 806E699B1C42BD9C00DE3A8B /* RswiftTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RswiftTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; D51335261C959DF20014C9D4 /* StoryboardViewControllerResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardViewControllerResource.swift; sourceTree = ""; }; @@ -186,15 +183,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2F5FBC4121355A1400A83A69 /* Rswift-watchOS */ = { - isa = PBXGroup; - children = ( - 2F5FBC4221355A1400A83A69 /* Rswift_watchOS.h */, - 2F5FBC4321355A1400A83A69 /* Info.plist */, - ); - path = "Rswift-watchOS"; - sourceTree = ""; - }; D543F9C21C14987000D16A0C /* UIKit */ = { isa = PBXGroup; children = ( @@ -248,7 +236,6 @@ children = ( D59246501C117A55007F94C7 /* Library */, D592465C1C117A55007F94C7 /* LibraryTests */, - 2F5FBC4121355A1400A83A69 /* Rswift-watchOS */, D592464F1C117A55007F94C7 /* Products */, ); indentWidth = 2; @@ -296,7 +283,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 2F5FBC4421355A1400A83A69 /* Rswift_watchOS.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -642,7 +628,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = "Rswift-watchOS/Info.plist"; + INFOPLIST_FILE = Library/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; @@ -675,7 +661,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = "Rswift-watchOS/Info.plist"; + INFOPLIST_FILE = Library/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_FAST_MATH = YES; diff --git a/Rswift-watchOS/Info.plist b/Rswift-watchOS/Info.plist deleted file mode 100644 index e1fe4cf..0000000 --- a/Rswift-watchOS/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - - diff --git a/Rswift-watchOS/Rswift_watchOS.h b/Rswift-watchOS/Rswift_watchOS.h deleted file mode 100644 index 5b0a159..0000000 --- a/Rswift-watchOS/Rswift_watchOS.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Rswift_watchOS.h -// Rswift-watchOS -// -// Created by Lammert Westerhoff on 28/08/2018. -// Copyright © 2018 Mathijs Kadijk. All rights reserved. -// - -#import - -//! Project version number for Rswift_watchOS. -FOUNDATION_EXPORT double Rswift_watchOSVersionNumber; - -//! Project version string for Rswift_watchOS. -FOUNDATION_EXPORT const unsigned char Rswift_watchOSVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - From 997b6e5e80991de0556ba28e3d5c06b317bffe95 Mon Sep 17 00:00:00 2001 From: Tom Lokhorst Date: Mon, 10 Jun 2019 22:04:53 +0200 Subject: [PATCH 4/4] Update to Swift 5 --- Library/UIKit/UIColor+ColorResource.swift | 2 +- Library/UIKit/UIImage+ImageResource.swift | 2 +- R.swift.Library.xcodeproj/project.pbxproj | 34 +++++++++++-------- .../xcschemes/Rswift-iOS.xcscheme | 24 ++++++------- .../xcschemes/Rswift-tvOS.xcscheme | 24 ++++++------- 5 files changed, 41 insertions(+), 45 deletions(-) diff --git a/Library/UIKit/UIColor+ColorResource.swift b/Library/UIKit/UIColor+ColorResource.swift index 4df3f15..6ee764d 100644 --- a/Library/UIKit/UIColor+ColorResource.swift +++ b/Library/UIKit/UIColor+ColorResource.swift @@ -36,7 +36,7 @@ public extension UIColor { - returns: A color that exactly or best matches the desired traits with the given resource (R.color.*), or nil if no suitable color was found. */ @available(watchOSApplicationExtension 4.0, *) - public convenience init?(resource: ColorResourceType) { + convenience init?(resource: ColorResourceType) { self.init(named: resource.name) } #endif diff --git a/Library/UIKit/UIImage+ImageResource.swift b/Library/UIKit/UIImage+ImageResource.swift index ec8b3d7..c764814 100644 --- a/Library/UIKit/UIImage+ImageResource.swift +++ b/Library/UIKit/UIImage+ImageResource.swift @@ -33,7 +33,7 @@ public extension UIImage { - returns: An image that exactly or best matches the desired traits with the given resource (R.image.*), or nil if no suitable image was found. */ - public convenience init?(resource: ImageResourceType) { + convenience init?(resource: ImageResourceType) { self.init(named: resource.name) } #endif diff --git a/R.swift.Library.xcodeproj/project.pbxproj b/R.swift.Library.xcodeproj/project.pbxproj index bd72db7..b1ea7f0 100644 --- a/R.swift.Library.xcodeproj/project.pbxproj +++ b/R.swift.Library.xcodeproj/project.pbxproj @@ -402,28 +402,29 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1100; ORGANIZATIONNAME = "Mathijs Kadijk"; TargetAttributes = { 2F5FBC3F21355A1400A83A69 = { CreatedOnToolsVersion = 10.0; + LastSwiftMigration = 1100; ProvisioningStyle = Automatic; }; 806E69911C42BD9C00DE3A8B = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; 806E699A1C42BD9C00DE3A8B = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; D592464D1C117A55007F94C7 = { CreatedOnToolsVersion = 7.1.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; D59246571C117A55007F94C7 = { CreatedOnToolsVersion = 7.1.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; }; }; @@ -432,6 +433,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = D59246441C117A54007F94C7; @@ -638,7 +640,7 @@ SDKROOT = watchos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.2; }; @@ -669,7 +671,7 @@ PRODUCT_NAME = Rswift; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.2; }; @@ -691,7 +693,7 @@ PRODUCT_NAME = Rswift; SDKROOT = appletvos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -713,7 +715,7 @@ PRODUCT_NAME = Rswift; SDKROOT = appletvos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -727,7 +729,7 @@ PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.RswiftTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.1; }; name = Debug; @@ -740,7 +742,7 @@ PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.RswiftTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.1; }; name = Release; @@ -749,6 +751,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -807,6 +810,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -873,7 +877,7 @@ PRODUCT_NAME = Rswift; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -894,7 +898,7 @@ PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.rswift.library; PRODUCT_NAME = Rswift; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -905,7 +909,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.RswiftTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -916,7 +920,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = nl.mathijskadijk.RswiftTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/R.swift.Library.xcodeproj/xcshareddata/xcschemes/Rswift-iOS.xcscheme b/R.swift.Library.xcodeproj/xcshareddata/xcschemes/Rswift-iOS.xcscheme index d317290..5d6d23f 100644 --- a/R.swift.Library.xcodeproj/xcshareddata/xcschemes/Rswift-iOS.xcscheme +++ b/R.swift.Library.xcodeproj/xcshareddata/xcschemes/Rswift-iOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - -