Skip to content

Commit dc50bce

Browse files
authored
Merge pull request #10 from SuperEasyApps/master
Swift 4 & Xcode 9 Updates
2 parents e30b5be + 6f2037d commit dc50bce

File tree

4 files changed

+93
-11
lines changed

4 files changed

+93
-11
lines changed

Sources/NSDictionary+UserTheme.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,23 @@ extension NSDictionary {
9191
// Resolve any variables
9292
var evaluatedStringValue = stringValue
9393
var rangeOffset = 0
94-
NSDictionary.varsRegExpr?.enumerateMatches(in: stringValue, options: NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count), using: { (match, flags, stop) in
94+
NSDictionary.varsRegExpr?.enumerateMatches(in: stringValue, options: NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.count), using: { (match, flags, stop) in
9595
if let matchRange = match?.range(at: 1) {
9696
var range = matchRange
9797
range.location += rangeOffset
9898

9999
// Extract variable
100100
let start = range.location + 1
101101
let end = start + range.length - 2
102-
guard start < evaluatedStringValue.characters.count && end < evaluatedStringValue.characters.count else { return }
102+
guard start < evaluatedStringValue.count && end < evaluatedStringValue.count else { return }
103103
let variable = evaluatedStringValue[start..<end]
104104

105105
// Evaluated value
106106
if let variableValue = evaluatedString(key: variable) {
107107
evaluatedStringValue = evaluatedStringValue.replacingCharacters(inNSRange: range, with: variableValue)
108108

109109
// Move offset forward
110-
rangeOffset = variableValue.characters.count - range.length
110+
rangeOffset = variableValue.count - range.length
111111
}
112112
else {
113113
// Move offset forward
@@ -129,7 +129,7 @@ extension NSDictionary {
129129
var evaluatedObject: AnyObject? = value
130130

131131
// linear-gradient(color1, color2)
132-
if let match = NSDictionary.linearGradRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count)),
132+
if let match = NSDictionary.linearGradRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.count)),
133133
match.numberOfRanges == 11 {
134134

135135
// Starting color
@@ -152,7 +152,7 @@ extension NSDictionary {
152152

153153
// rgb/rgba color
154154
if evaluatedObject is String,
155-
let match = NSDictionary.colorRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count)),
155+
let match = NSDictionary.colorRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.count)),
156156
match.numberOfRanges == 5 {
157157

158158
let red = (Float(stringValue.substring(withNSRange: match.range(at: 1))) ?? 255) / 255
@@ -166,7 +166,7 @@ extension NSDictionary {
166166

167167
// pattern
168168
if evaluatedObject is String,
169-
let match = NSDictionary.patternRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count)),
169+
let match = NSDictionary.patternRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.count)),
170170
match.numberOfRanges == 6 {
171171

172172
let isNamedType = stringValue.substring(withNSRange: match.range(at: 2)) == "named"
@@ -190,7 +190,7 @@ extension NSDictionary {
190190

191191
// image
192192
if evaluatedObject is String,
193-
let match = NSDictionary.imageRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count)),
193+
let match = NSDictionary.imageRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.count)),
194194
match.numberOfRanges == 6 {
195195

196196
let isNamedType = stringValue.substring(withNSRange: match.range(at: 2)) == "named"

Sources/String+Substring.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension String {
3030

3131
/// Convenience function to get substring with NSRange.
3232
internal func substring(withNSRange: NSRange) -> String {
33-
guard withNSRange.location < self.characters.count else { return "" }
33+
guard withNSRange.location < self.count else { return "" }
3434
let start = self.index(self.startIndex, offsetBy: withNSRange.location)
3535
let end = self.index(start, offsetBy: withNSRange.length)
3636
let range = Range<String.Index>(uncheckedBounds: (lower: start, upper: end))
@@ -39,7 +39,7 @@ extension String {
3939

4040
/// Convenience function to replace characters with NSRange.
4141
internal func replacingCharacters(inNSRange: NSRange, with: String) -> String {
42-
guard inNSRange.location < self.characters.count else { return "" }
42+
guard inNSRange.location < self.count else { return "" }
4343
let start = self.index(self.startIndex, offsetBy: inNSRange.location)
4444
let end = self.index(start, offsetBy: inNSRange.length)
4545
let range = Range<String.Index>(uncheckedBounds: (lower: start, upper: end))
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0910"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "286DE7C71D92DF8F00767E00"
18+
BuildableName = "ThemeKit.framework"
19+
BlueprintName = "ThemeKit"
20+
ReferencedContainer = "container:ThemeKit.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
30+
shouldUseLaunchSchemeArgsEnv = "YES">
31+
<Testables>
32+
</Testables>
33+
<AdditionalOptions>
34+
</AdditionalOptions>
35+
</TestAction>
36+
<LaunchAction
37+
buildConfiguration = "Debug"
38+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
39+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
40+
language = ""
41+
launchStyle = "0"
42+
useCustomWorkingDirectory = "NO"
43+
ignoresPersistentStateOnLaunch = "NO"
44+
debugDocumentVersioning = "YES"
45+
debugServiceExtension = "internal"
46+
allowLocationSimulation = "YES">
47+
<MacroExpansion>
48+
<BuildableReference
49+
BuildableIdentifier = "primary"
50+
BlueprintIdentifier = "286DE7C71D92DF8F00767E00"
51+
BuildableName = "ThemeKit.framework"
52+
BlueprintName = "ThemeKit"
53+
ReferencedContainer = "container:ThemeKit.xcodeproj">
54+
</BuildableReference>
55+
</MacroExpansion>
56+
<AdditionalOptions>
57+
</AdditionalOptions>
58+
</LaunchAction>
59+
<ProfileAction
60+
buildConfiguration = "Release"
61+
shouldUseLaunchSchemeArgsEnv = "YES"
62+
savedToolIdentifier = ""
63+
useCustomWorkingDirectory = "NO"
64+
debugDocumentVersioning = "YES">
65+
<MacroExpansion>
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "286DE7C71D92DF8F00767E00"
69+
BuildableName = "ThemeKit.framework"
70+
BlueprintName = "ThemeKit"
71+
ReferencedContainer = "container:ThemeKit.xcodeproj">
72+
</BuildableReference>
73+
</MacroExpansion>
74+
</ProfileAction>
75+
<AnalyzeAction
76+
buildConfiguration = "Debug">
77+
</AnalyzeAction>
78+
<ArchiveAction
79+
buildConfiguration = "Release"
80+
revealArchiveInOrganizer = "YES">
81+
</ArchiveAction>
82+
</Scheme>

macOSThemeKit.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'macOSThemeKit'
3-
s.version = '1.1.0'
3+
s.version = '1.1.1'
44
s.license = { :type => 'MIT', :file => 'LICENSE' }
55
s.summary = 'macOS Theming Framework'
66
s.homepage = 'https://github.com/luckymarmot/ThemeKit'
@@ -15,4 +15,4 @@ Pod::Spec.new do |s|
1515
s.requires_arc = true
1616

1717
s.source_files = 'Sources/**/*.swift'
18-
end
18+
end

0 commit comments

Comments
 (0)