Updating to Swift 4.2

This commit is contained in:
Simon Fairbairn 2018-10-11 12:29:03 +01:00
parent 85b1a0b944
commit 3848d54e45
4 changed files with 47 additions and 35 deletions

View File

@ -154,15 +154,17 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Voyage Travel Apps";
TargetAttributes = {
F4CE98801C8A921300D735C1 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
};
F4CE988A1C8A921300D735C1 = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = 52T262DA8V;
LastSwiftMigration = 1000;
};
};
};
@ -243,12 +245,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;
@ -299,12 +303,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;
@ -358,7 +364,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@ -383,29 +389,33 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
F4CE98991C8A921300D735C1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = 52T262DA8V;
INFOPLIST_FILE = SwiftyMarkdownTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.voyagetravelapps.SwiftyMarkdownTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
F4CE989A1C8A921300D735C1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = 52T262DA8V;
INFOPLIST_FILE = SwiftyMarkdownTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.voyagetravelapps.SwiftyMarkdownTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Release;
};

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"

View File

@ -22,7 +22,7 @@ A struct defining the styles that can be applied to the parsed Markdown. The `fo
If that is not set, then the system default will be used.
*/
@objc open class BasicStyles : NSObject, FontProperties {
public var fontName : String? = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body).fontName
public var fontName : String? = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body).fontName
public var color = UIColor.black
public var fontSize : CGFloat = 0.0
}
@ -296,7 +296,7 @@ enum LineStyle : Int {
var style = LineStyle.styleFromString(results.foundCharacters)
var attributes = [NSAttributedStringKey : AnyObject]()
var attributes = [NSAttributedString.Key : AnyObject]()
if style == .link {
var linkText : NSString?
@ -311,7 +311,7 @@ enum LineStyle : Int {
if let hasLink = linkText, let hasURL = linkURL {
followingString = hasLink
attributes[NSAttributedStringKey.link] = hasURL
attributes[NSAttributedString.Key.link] = hasURL
} else {
style = .none
}
@ -367,8 +367,8 @@ enum LineStyle : Int {
// Make H1
func attributedStringFromString(_ string : String, withStyle style : LineStyle, attributes : [NSAttributedStringKey : AnyObject] = [:] ) -> NSAttributedString {
let textStyle : UIFontTextStyle
func attributedStringFromString(_ string : String, withStyle style : LineStyle, attributes : [NSAttributedString.Key : AnyObject] = [:] ) -> NSAttributedString {
let textStyle : UIFont.TextStyle
var fontName : String?
var attributes = attributes
var fontSize : CGFloat?
@ -381,49 +381,49 @@ enum LineStyle : Int {
fontName = h1.fontName
fontSize = h1.fontSize
if #available(iOS 9, *) {
textStyle = UIFontTextStyle.title1
textStyle = UIFont.TextStyle.title1
} else {
textStyle = UIFontTextStyle.headline
textStyle = UIFont.TextStyle.headline
}
attributes[NSAttributedStringKey.foregroundColor] = h1.color
attributes[NSAttributedString.Key.foregroundColor] = h1.color
case .h2:
fontName = h2.fontName
fontSize = h2.fontSize
if #available(iOS 9, *) {
textStyle = UIFontTextStyle.title2
textStyle = UIFont.TextStyle.title2
} else {
textStyle = UIFontTextStyle.headline
textStyle = UIFont.TextStyle.headline
}
attributes[NSAttributedStringKey.foregroundColor] = h2.color
attributes[NSAttributedString.Key.foregroundColor] = h2.color
case .h3:
fontName = h3.fontName
fontSize = h3.fontSize
if #available(iOS 9, *) {
textStyle = UIFontTextStyle.title2
textStyle = UIFont.TextStyle.title2
} else {
textStyle = UIFontTextStyle.subheadline
textStyle = UIFont.TextStyle.subheadline
}
attributes[NSAttributedStringKey.foregroundColor] = h3.color
attributes[NSAttributedString.Key.foregroundColor] = h3.color
case .h4:
fontName = h4.fontName
fontSize = h4.fontSize
textStyle = UIFontTextStyle.headline
attributes[NSAttributedStringKey.foregroundColor] = h4.color
textStyle = UIFont.TextStyle.headline
attributes[NSAttributedString.Key.foregroundColor] = h4.color
case .h5:
fontName = h5.fontName
fontSize = h5.fontSize
textStyle = UIFontTextStyle.subheadline
attributes[NSAttributedStringKey.foregroundColor] = h5.color
textStyle = UIFont.TextStyle.subheadline
attributes[NSAttributedString.Key.foregroundColor] = h5.color
case .h6:
fontName = h6.fontName
fontSize = h6.fontSize
textStyle = UIFontTextStyle.footnote
attributes[NSAttributedStringKey.foregroundColor] = h6.color
textStyle = UIFont.TextStyle.footnote
attributes[NSAttributedString.Key.foregroundColor] = h6.color
default:
fontName = body.fontName
fontSize = body.fontSize
textStyle = UIFontTextStyle.body
attributes[NSAttributedStringKey.foregroundColor] = body.color
textStyle = UIFont.TextStyle.body
attributes[NSAttributedString.Key.foregroundColor] = body.color
break
}
@ -432,13 +432,13 @@ enum LineStyle : Int {
if style == .code {
fontName = code.fontName
fontSize = code.fontSize
attributes[NSAttributedStringKey.foregroundColor] = code.color
attributes[NSAttributedString.Key.foregroundColor] = code.color
}
if style == .link {
fontName = link.fontName
fontSize = link.fontSize
attributes[NSAttributedStringKey.foregroundColor] = link.color
attributes[NSAttributedString.Key.foregroundColor] = link.color
}
// Fallback to body
@ -475,7 +475,7 @@ enum LineStyle : Int {
}
attributes[NSAttributedStringKey.font] = finalFont
attributes[NSAttributedString.Key.font] = finalFont
return NSAttributedString(string: string, attributes: attributes)
}

View File

@ -233,7 +233,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Voyage Travel Apps";
TargetAttributes = {
F4CE98A71C8AEF7D00D735C1 = {
@ -396,12 +396,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;
@ -449,12 +451,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;