From 49b3ebae4d126ac6a6dba7bdc95094c2d20b378a Mon Sep 17 00:00:00 2001 From: rob phillips Date: Fri, 26 Apr 2019 19:15:48 -0400 Subject: [PATCH] [Swift] Update to Swift 5.0 (#145) * [Swift] Update to Swift 5.0 * [Swift] Update README * [CI] Update travis to Xcode 10.2 --- .swift-version | 2 +- .travis.yml | 2 +- Down-Example/Down-Example.xcodeproj/project.pbxproj | 13 ++++++------- Down.podspec | 4 ++-- Down.xcodeproj/project.pbxproj | 12 ++++-------- README.md | 4 ++-- Source/AST/Stylers/Styler.swift | 2 +- Tests/VisitorTests.swift | 2 +- 8 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.swift-version b/.swift-version index 389f7740..819e07a2 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 \ No newline at end of file +5.0 diff --git a/.travis.yml b/.travis.yml index 7f2c6c03..71f9906f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -osx_image: xcode10.1 +osx_image: xcode10.2 language: objective-c before_install: - set -o pipefail diff --git a/Down-Example/Down-Example.xcodeproj/project.pbxproj b/Down-Example/Down-Example.xcodeproj/project.pbxproj index 51f5d874..c407fcfa 100644 --- a/Down-Example/Down-Example.xcodeproj/project.pbxproj +++ b/Down-Example/Down-Example.xcodeproj/project.pbxproj @@ -244,6 +244,7 @@ 14090A482185411800503C06 = { CreatedOnToolsVersion = 10.0; DevelopmentTeam = NWN7H36NTR; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.Sandbox = { @@ -253,7 +254,7 @@ }; 8A07D7CE1F085EC6004D7141 = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; }; }; @@ -407,7 +408,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.glazeddonut.macOS-Demo"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -432,7 +433,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.glazeddonut.macOS-Demo"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -567,8 +568,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.glazeddonut.Down-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -588,8 +588,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.glazeddonut.Down-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Down.podspec b/Down.podspec index c0862afd..a6dc45da 100644 --- a/Down.podspec +++ b/Down.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "Down" spec.summary = "Blazing fast Markdown rendering in Swift, built upon cmark." - spec.version = "0.8.0" + spec.version = "0.8.1" spec.homepage = "https://github.com/iwasrobbed/Down" spec.license = { :type => "MIT", :file => "LICENSE" } spec.authors = { "Rob Phillips" => "rob@robphillips.me" } @@ -20,5 +20,5 @@ Pod::Spec.new do |spec| spec.compiler_flags = '-Wno-shorten-64-to-32' spec.ios.resource = 'Resources/DownView.bundle' spec.osx.resource = 'Resources/DownView.bundle' - spec.swift_version = "4.0" + spec.swift_version = "5.0" end diff --git a/Down.xcodeproj/project.pbxproj b/Down.xcodeproj/project.pbxproj index 0e98e198..a65de6fb 100644 --- a/Down.xcodeproj/project.pbxproj +++ b/Down.xcodeproj/project.pbxproj @@ -735,8 +735,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = "${SRCROOT}/Source/cmark"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -757,8 +756,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = "${SRCROOT}/Source/cmark"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -768,8 +766,7 @@ buildSettings = { INFOPLIST_FILE = "Resources/DownTests-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = com.glazeddonut.DownTests; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -779,8 +776,7 @@ buildSettings = { INFOPLIST_FILE = "Resources/DownTests-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = com.glazeddonut.DownTests; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/README.md b/README.md index a107464f..ec11e863 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/iwasrobbed/Down.svg?branch=master)](https://travis-ci.org/iwasrobbed/Down) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/iwasrobbed/Down/blob/master/LICENSE) [![CocoaPods](https://img.shields.io/cocoapods/v/Down.svg?maxAge=10800)]() -[![Swift 4](https://img.shields.io/badge/language-Swift-blue.svg)](https://swift.org) +[![Swift 5](https://img.shields.io/badge/language-Swift-blue.svg)](https://swift.org) [![macOS](https://img.shields.io/badge/OS-macOS-orange.svg)](https://developer.apple.com/macos/) [![iOS](https://img.shields.io/badge/OS-iOS-orange.svg)](https://developer.apple.com/ios/) [![tvOS](https://img.shields.io/badge/OS-tvOS-orange.svg)](https://developer.apple.com/tvos/) @@ -25,7 +25,7 @@ Is your app using it? [Let us know!](mailto:rob@robphillips.me) ### Installation -Note: Swift 4 support is now on the `master` branch and any tag >= 0.4.x (Swift 3 is 0.3.x) +Note: Swift 5 support is now on the `master` branch and any tag >= 0.8.1 (Swift 4 is >= 0.4.x, Swift 3 is 0.3.x) Quickly install using [CocoaPods](https://cocoapods.org): diff --git a/Source/AST/Stylers/Styler.swift b/Source/AST/Stylers/Styler.swift index eecc04b7..2ab7e91f 100644 --- a/Source/AST/Stylers/Styler.swift +++ b/Source/AST/Stylers/Styler.swift @@ -36,5 +36,5 @@ public protocol Styler { func style(link str: NSMutableAttributedString, title: String?, url: String?) func style(image str: NSMutableAttributedString, title: String?, url: String?) - var listPrefixAttributes: [NSAttributedStringKey: Any] { get } + var listPrefixAttributes: [NSAttributedString.Key: Any] { get } } diff --git a/Tests/VisitorTests.swift b/Tests/VisitorTests.swift index 342849d9..faeaa3c3 100644 --- a/Tests/VisitorTests.swift +++ b/Tests/VisitorTests.swift @@ -101,7 +101,7 @@ class VisitorTests: XCTestCase { } private class EmptyStyler: Styler { - var listPrefixAttributes: [NSAttributedStringKey : Any] = [:] + var listPrefixAttributes: [NSAttributedString.Key : Any] = [:] func style(document str: NSMutableAttributedString) {} func style(blockQuote str: NSMutableAttributedString) {} func style(list str: NSMutableAttributedString) {}