Skip to content

Commit

Permalink
Merge pull request #26 from prolificinteractive/chore/swift-4.2-migra…
Browse files Browse the repository at this point in the history
…tion

Swift 4.2 Update
  • Loading branch information
malinkas86 authored Oct 22, 2018
2 parents 3cb8bd7 + fb16404 commit ad377ca
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
language: objective-c
osx_image: xcode9
osx_image: xcode10
podfile: Example/Podfile

before_install:
- gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet

script:
- set -o pipefail && xcodebuild test -project Marker/Marker.xcodeproj -scheme Marker-iOS -destination 'name=iPhone 7,OS=11.0' | xcpretty
- set -o pipefail && xcodebuild test -project Marker/Marker.xcodeproj -scheme Marker-iOS -destination 'name=iPhone 8,OS=12.0' | xcpretty
- set -o pipefail && xcodebuild test -project Marker/Marker.xcodeproj -scheme Marker-macOS -destination 'arch=x86_64' | xcpretty
- set -o pipefail && xcodebuild test -project Marker/Marker.xcodeproj -scheme Marker-tvOS -destination 'name=Apple TV 1080p,OS=11.0' | xcpretty
- pod lib lint
2 changes: 1 addition & 1 deletion Example/Marker-Example-iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// MARK: - Instance functions

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
if let viewController = window?.rootViewController as? ViewController {
viewController.theme = theme
}
Expand Down
4 changes: 2 additions & 2 deletions Example/Marker-Example-iOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ internal final class ViewController: UIViewController {
private func registerForNotifications() {
NotificationCenter.default.addObserver(self,
selector: #selector(ViewController.updateViews),
name: NSNotification.Name.UIContentSizeCategoryDidChange,
name: UIContentSizeCategory.didChangeNotification,
object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(ViewController.updateViews),
name: NSNotification.Name(rawValue: AppTheme.Constants.fontThemeDidChangeNotification),
name: Notification.Name(rawValue: AppTheme.Constants.fontThemeDidChangeNotification),
object: nil)
}

Expand Down
38 changes: 3 additions & 35 deletions Example/Marker-Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@
271C85D21ED4E40800F8BBBB /* Frameworks */,
271C85D31ED4E40800F8BBBB /* Resources */,
FAF73D195B963F0D4B5861A5 /* [CP] Embed Pods Frameworks */,
2C97776FB52214BDCF7F7BD2 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -202,7 +201,6 @@
272D862D1ED62E9C00CE29EB /* Frameworks */,
272D862E1ED62E9C00CE29EB /* Resources */,
40B7CC52E028A1EB1F9E75FE /* [CP] Embed Pods Frameworks */,
99D7069AFB3C7D29D4F26C07 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -220,7 +218,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 1000;
TargetAttributes = {
271C85D41ED4E40800F8BBBB = {
CreatedOnToolsVersion = 8.3.2;
Expand Down Expand Up @@ -313,21 +311,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
2C97776FB52214BDCF7F7BD2 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Marker-Example-iOS/Pods-Marker-Example-iOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
40B7CC52E028A1EB1F9E75FE /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -346,21 +329,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Marker-Example-macOS/Pods-Marker-Example-macOS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
99D7069AFB3C7D29D4F26C07 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Marker-Example-macOS/Pods-Marker-Example-macOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
FAF73D195B963F0D4B5861A5 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -509,7 +477,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand Down Expand Up @@ -560,7 +528,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
Expand Down
8 changes: 4 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- Marker (1.1.0)
- Marker (1.2.0)

DEPENDENCIES:
- Marker (from `../`)

EXTERNAL SOURCES:
Marker:
:path: ../
:path: "../"

SPEC CHECKSUMS:
Marker: ef3ead037c66a1340eec2fd9f79b27cb36dcbec3
Marker: 78178ba8e5f702b64227c4371ed5b9533984d0cd

PODFILE CHECKSUM: 2d22b0ce73bebf9f2dee7cbf15b441cc137adc5e

COCOAPODS: 1.3.1
COCOAPODS: 1.5.3
2 changes: 1 addition & 1 deletion Example/Theme/MarkerExampleFontTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal struct MarkerExampleFontTheme: FontTheme {
emFont: emFont,
strongFont: strongFont,
characterSpacing: characterSpacing,
strikethroughStyle: .styleThick,
strikethroughStyle: .thick,
strikethroughColor: .white,
textTransform: .uppercased)
}
Expand Down
2 changes: 1 addition & 1 deletion Marker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Marker"
s.version = "1.1.0"
s.version = "1.2.0"
s.summary = "A light wrapper around NSAttributedString."
s.description = <<-DESC
TODO: Add long description of the pod here.
Expand Down
4 changes: 2 additions & 2 deletions Marker/Marker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@
PRODUCT_NAME = Marker;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -932,7 +932,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.Marker;
PRODUCT_NAME = Marker;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
20 changes: 10 additions & 10 deletions Marker/Marker/TextAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@

#if swift(>=4.0)
/// Text attributes.
public typealias TextAttributes = [NSAttributedStringKey: Any]
public typealias TextAttributes = [NSAttributedString.Key: Any]

struct AttributedStringKey {

static let font = NSAttributedStringKey.font
static let foregroundColor = NSAttributedStringKey.foregroundColor
static let kern = NSAttributedStringKey.kern
static let link = NSAttributedStringKey.link
static let paragraphStyle = NSAttributedStringKey.paragraphStyle
static let strikethroughStyle = NSAttributedStringKey.strikethroughStyle
static let strikethroughColor = NSAttributedStringKey.strikethroughColor
static let underlineStyle = NSAttributedStringKey.underlineStyle
static let underlineColor = NSAttributedStringKey.underlineColor
static let font = NSAttributedString.Key.font
static let foregroundColor = NSAttributedString.Key.foregroundColor
static let kern = NSAttributedString.Key.kern
static let link = NSAttributedString.Key.link
static let paragraphStyle = NSAttributedString.Key.paragraphStyle
static let strikethroughStyle = NSAttributedString.Key.strikethroughStyle
static let strikethroughColor = NSAttributedString.Key.strikethroughColor
static let underlineStyle = NSAttributedString.Key.underlineStyle
static let underlineColor = NSAttributedString.Key.underlineColor

}
#else
Expand Down
4 changes: 2 additions & 2 deletions Marker/Marker/TextStyle+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public extension TextStyle {
/// - color: Strikethrough color. Defaults to textColor.
/// - style: Strikethrough style. Defaults to single line.
/// - Returns: New TextStyle with strikethrough.
public func strikethrough(color: Color? = nil, style: NSUnderlineStyle = .styleSingle) -> TextStyle {
public func strikethrough(color: Color? = nil, style: NSUnderlineStyle = .single) -> TextStyle {
return self.with(
newStrikethroughStyle: style,
newStrikethroughColor: color ?? textColor
Expand All @@ -128,7 +128,7 @@ public extension TextStyle {
/// - Parameter color: Underline color. Defaults to textColor.
/// - Parameter style: Underline style. Defaults to single line.
/// - Returns: New TextStyle with underline.
public func underlined(color: Color? = nil, style: NSUnderlineStyle = .styleSingle) -> TextStyle {
public func underlined(color: Color? = nil, style: NSUnderlineStyle = .single) -> TextStyle {
return self.with(
newUnderlineStyle: style,
newUnderlineColor: color ?? textColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public extension UIButton {
func setTitleText(_ text: String,
using textStyle: TextStyle,
customMarkup markups: Markup = [:],
forState state: UIControlState = .normal) {
forState state: UIControl.State = .normal) {
setAttributedTitle(attributedMarkupString(from: text, using: textStyle, customMarkup: markups), for: state)
}

Expand All @@ -34,7 +34,7 @@ public extension UIButton {
/// - state: The button state to set.
func setMarkdownTitleText(_ markdownText: String,
using textStyle: TextStyle,
forState state: UIControlState = .normal) {
forState state: UIControl.State = .normal) {
setAttributedTitle(attributedMarkdownString(from: markdownText, using: textStyle), for: state)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ public extension UITextView {
/// - textStyle: Text style object containing style information.
func setMarkdownText(_ markdownText: String, using textStyle: TextStyle) {
if let linkColor = textStyle.linkColor {
#if swift(>=4.0)
linkTextAttributes = [AttributedStringKey.foregroundColor.rawValue: linkColor]
#else
linkTextAttributes = [AttributedStringKey.foregroundColor: linkColor]
#endif
}

attributedText = attributedMarkdownString(from: markdownText, using: textStyle)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Platform](https://img.shields.io/cocoapods/p/Marker.svg?style=flat-square)](http://cocoadocs.org/docsets/Marker)
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/Marker.svg?style=flat-square)](http://cocoadocs.org/docsets/Marker)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
![Swift Version](https://img.shields.io/badge/Swift-4.2-orange.svg)

## Description

Expand Down

0 comments on commit ad377ca

Please sign in to comment.