From ddc8e4940945bcd569c5219b99adfb56c027b614 Mon Sep 17 00:00:00 2001 From: Stefan Trauth Date: Fri, 5 Apr 2019 11:00:32 +0200 Subject: [PATCH] update to swift 5 and update project settings to xcode recommended settings --- .swift-version | 2 +- Example.xcodeproj/project.pbxproj | 16 ++++++++++++++-- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ .../xcschemes/Notepad-macOS.xcscheme | 4 +--- .../xcshareddata/xcschemes/Notepad.xcscheme | 4 +--- Example/AppDelegate.swift | 4 +--- Example/ViewController.swift | 2 +- Notepad/UniversalTypes.swift | 2 +- 8 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.swift-version b/.swift-version index 5186d07..819e07a 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +5.0 diff --git a/Example.xcodeproj/project.pbxproj b/Example.xcodeproj/project.pbxproj index d545965..6c05240 100644 --- a/Example.xcodeproj/project.pbxproj +++ b/Example.xcodeproj/project.pbxproj @@ -349,7 +349,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Rudd Fawcett"; TargetAttributes = { 504B6FFF1F21D051002F9D8E = { @@ -376,7 +376,7 @@ }; buildConfigurationList = F1730EAF1DAEA6BE00E2BB0B /* Build configuration list for PBXProject "Example" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -553,6 +553,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -572,6 +573,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.ruddfawcett.Example-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -598,6 +600,7 @@ SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -625,6 +628,7 @@ PRODUCT_NAME = Notepad; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -643,12 +647,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -698,12 +704,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -744,6 +752,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ruddfawcett.Example; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -758,6 +767,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ruddfawcett.Example; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -781,6 +791,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -804,6 +815,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.ruddfawcett.Notepad; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example.xcodeproj/xcshareddata/xcschemes/Notepad-macOS.xcscheme b/Example.xcodeproj/xcshareddata/xcschemes/Notepad-macOS.xcscheme index f4b8736..8e63dbd 100644 --- a/Example.xcodeproj/xcshareddata/xcschemes/Notepad-macOS.xcscheme +++ b/Example.xcodeproj/xcshareddata/xcschemes/Notepad-macOS.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Example.xcodeproj/xcshareddata/xcschemes/Notepad.xcscheme b/Example.xcodeproj/xcshareddata/xcschemes/Notepad.xcscheme index 6b45b15..ed04586 100644 --- a/Example.xcodeproj/xcshareddata/xcschemes/Notepad.xcscheme +++ b/Example.xcodeproj/xcshareddata/xcschemes/Notepad.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift index 507c680..ec98f73 100644 --- a/Example/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -13,9 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { return true } diff --git a/Example/ViewController.swift b/Example/ViewController.swift index 014a032..bcd64d7 100644 --- a/Example/ViewController.swift +++ b/Example/ViewController.swift @@ -24,7 +24,7 @@ class ViewController: UIViewController { print(error) } - editor.textContainerInset = UIEdgeInsetsMake(40, 20, 40, 20) + editor.textContainerInset = UIEdgeInsets(top: 40, left: 20, bottom: 40, right: 20) self.view.addSubview(editor) } diff --git a/Notepad/UniversalTypes.swift b/Notepad/UniversalTypes.swift index ba9d429..87ec1a7 100644 --- a/Notepad/UniversalTypes.swift +++ b/Notepad/UniversalTypes.swift @@ -11,7 +11,7 @@ public typealias UniversalColor = UIColor public typealias UniversalFont = UIFont public typealias UniversalFontDescriptor = UIFontDescriptor - public typealias UniversalTraits = UIFontDescriptorSymbolicTraits + public typealias UniversalTraits = UIFontDescriptor.SymbolicTraits #elseif os(macOS) import AppKit public typealias UniversalColor = NSColor