Skip to content

Commit b7fa955

Browse files
committed
Upgrading to Swift 5, fixing warnings, cleanup for cocoapods
1 parent c90dc5d commit b7fa955

File tree

8 files changed

+41
-39
lines changed

8 files changed

+41
-39
lines changed

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ platform :ios, '10.0'
3232
use_frameworks!
3333

3434
target '<Your Target Name>' do
35-
pod 'Texty', '~> 0.2.3'
35+
pod 'Texty', '~> 0.2.6'
3636
end
3737
```
3838

@@ -53,7 +53,7 @@ $ brew install carthage
5353

5454
To integrate Texty into your Xcode project using Carthage, specify it in your `Cartfile`:
5555
```ogdl
56-
github "Vectorform/Texty" ~> 0.2.3
56+
github "Vectorform/Texty" ~> 0.2.6
5757
```
5858

5959
Run `carthage update` to build the framework and drag the built `Texty.framework` into your Xcode project.

Source/Scanner.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@ import Foundation
3232
internal extension Scanner {
3333

3434

35-
internal func incrementLocation() {
35+
func incrementLocation() {
3636
guard !self.isAtEnd else {
3737
return
3838
}
3939
self.scanLocation += 1
4040
}
4141

42-
internal func scan(upto string: String) -> String? {
42+
func scan(upto string: String) -> String? {
4343
var ptr: NSString? = ""
4444
guard self.scanUpTo(string, into: &ptr) || ((!self.isAtEnd) && ((self.string as NSString).substring(from: self.scanLocation).hasPrefix(string))) else {
4545
return nil
4646
}
4747
return ptr as String?
4848
}
4949

50-
internal func scanUpToString(_ string: String) -> String? {
50+
func scanUpToString(_ string: String) -> String? {
5151
var ptr: NSString? = ""
5252
guard self.scanUpTo(string, into: &ptr) || (!self.isAtEnd) else {
5353
return nil
5454
}
5555
return ptr as String?
5656
}
5757

58-
internal func scanUpToCharacters(_ characterSet: CharacterSet) -> String? {
58+
func scanUpToCharacters(_ characterSet: CharacterSet) -> String? {
5959
var ptr: NSString? = ""
6060
guard self.scanUpToCharacters(from: characterSet, into: &ptr) || (!self.isAtEnd) else {
6161
return nil

Source/String.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ internal extension String {
7070
}
7171

7272

73-
internal mutating func findAndRemoveTags() -> [(tag: String, range: NSRange)] {
73+
mutating func findAndRemoveTags() -> [(tag: String, range: NSRange)] {
7474
let scanner: Scanner = Scanner(string: self)
7575

7676
var tagLocation: Int
@@ -142,7 +142,7 @@ internal extension String {
142142

143143
//The tag is closing, and we need to find the first opening tag for it
144144
//== compares Tag.name properties only
145-
guard let index = openTags.index(of: tag) else {
145+
guard let index = openTags.firstIndex(of: tag) else {
146146
assertionFailure("Texty: closing tag found without opening tag (unbalanced tags found in string)")
147147
continue
148148
}
@@ -161,7 +161,7 @@ internal extension String {
161161
}
162162

163163

164-
internal mutating func stripTags() -> [String : NSRange] {
164+
mutating func stripTags() -> [String : NSRange] {
165165
let scanner: Scanner = Scanner(string: self)
166166
var tags: [String : NSRange] = [:]
167167
var locationOffset: Int = 0

Source/Tag.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ internal struct Tag: Hashable {
4040
internal let name: String
4141
internal let location: Int
4242

43-
44-
public var hashValue: Int { return self.name.hashValue }
43+
func hash(into hasher: inout Hasher) {
44+
return self.name.hash(into: &hasher)
45+
}
4546

4647

4748
public init(string: String, location: Int, closing: Bool, short: Bool) {

Source/TextStyle.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -109,112 +109,112 @@ public class TextStyle {
109109
}
110110

111111
public extension TextStyle {
112-
public var attachment: NSTextAttachment? {
112+
var attachment: NSTextAttachment? {
113113
get { return self.attributes[TextAttribute.attachment.NSAttribute] as? NSTextAttachment }
114114
set { self.set(value: newValue, for: TextAttribute.attachment) }
115115
}
116116

117-
public var backgroundColor: UIColor? {
117+
var backgroundColor: UIColor? {
118118
get { return self.attributes[TextAttribute.backgroundColor.NSAttribute] as? UIColor }
119119
set { self.set(value: newValue, for: TextAttribute.backgroundColor) }
120120
}
121121

122-
public var baselineOffset: NSNumber? {
122+
var baselineOffset: NSNumber? {
123123
get { return self.attributes[TextAttribute.baselineOffset.NSAttribute] as? NSNumber }
124124
set { self.set(value: newValue, for: TextAttribute.baselineOffset) }
125125
}
126126

127-
public var expansion: NSNumber? {
127+
var expansion: NSNumber? {
128128
get { return self.attributes[TextAttribute.expansion.NSAttribute] as? NSNumber }
129129
set { self.set(value: newValue, for: TextAttribute.expansion) }
130130
}
131131

132-
public var font: UIFont? {
132+
var font: UIFont? {
133133
get { return self.attributes[TextAttribute.font.NSAttribute] as? UIFont }
134134
set { self.set(value: newValue, for: TextAttribute.font) }
135135
}
136136

137-
public var foregroundColor: UIColor? {
137+
var foregroundColor: UIColor? {
138138
get { return self.attributes[TextAttribute.foregroundColor.NSAttribute] as? UIColor }
139139
set { self.set(value: newValue, for: TextAttribute.foregroundColor) }
140140
}
141141

142-
public var kern: NSNumber? {
142+
var kern: NSNumber? {
143143
get { return self.attributes[TextAttribute.kern.NSAttribute] as? NSNumber }
144144
set { self.set(value: newValue, for: TextAttribute.kern) }
145145
}
146146

147-
public var ligature: NSNumber? {
147+
var ligature: NSNumber? {
148148
get { return self.attributes[TextAttribute.ligature.NSAttribute] as? NSNumber }
149149
set { self.set(value: newValue, for: TextAttribute.ligature) }
150150
}
151151

152-
public var linkString: NSString? {
152+
var linkString: NSString? {
153153
get { return self.attributes[TextAttribute.link.NSAttribute] as? NSString }
154154
set { self.set(value: newValue, for: TextAttribute.link) }
155155
}
156156

157-
public var linkURL: NSURL? {
157+
var linkURL: NSURL? {
158158
get { return self.attributes[TextAttribute.link.NSAttribute] as? NSURL }
159159
set { self.set(value: newValue, for: TextAttribute.link) }
160160
}
161161

162-
public var obliqueness: NSNumber? {
162+
var obliqueness: NSNumber? {
163163
get { return self.attributes[TextAttribute.obliqueness.NSAttribute] as? NSNumber }
164164
set { self.set(value: newValue, for: TextAttribute.obliqueness) }
165165
}
166166

167-
public var paragraphStyle: NSParagraphStyle? {
167+
var paragraphStyle: NSParagraphStyle? {
168168
get { return self.attributes[TextAttribute.paragraphStyle.NSAttribute] as? NSParagraphStyle }
169169
set { self.set(value: newValue, for: TextAttribute.paragraphStyle) }
170170
}
171171

172-
public var shadow: NSShadow? {
172+
var shadow: NSShadow? {
173173
get { return self.attributes[TextAttribute.shadow.NSAttribute] as? NSShadow }
174174
set { self.set(value: newValue, for: TextAttribute.shadow) }
175175
}
176176

177-
public var strikethroughColor: UIColor? {
177+
var strikethroughColor: UIColor? {
178178
get { return self.attributes[TextAttribute.strikethroughColor.NSAttribute] as? UIColor }
179179
set { self.set(value: newValue, for: TextAttribute.strikethroughColor) }
180180
}
181181

182-
public var strikethroughStyle: NSNumber? {
182+
var strikethroughStyle: NSNumber? {
183183
get { return self.attributes[TextAttribute.strikethroughStyle.NSAttribute] as? NSNumber }
184184
set { self.set(value: newValue, for: TextAttribute.strikethroughStyle) }
185185
}
186186

187-
public var strokeColor: UIColor? {
187+
var strokeColor: UIColor? {
188188
get { return self.attributes[TextAttribute.strokeColor.NSAttribute] as? UIColor }
189189
set { self.set(value: newValue, for: TextAttribute.strokeColor) }
190190
}
191191

192-
public var strokeWidth: NSNumber? {
192+
var strokeWidth: NSNumber? {
193193
get { return self.attributes[TextAttribute.strokeWidth.NSAttribute] as? NSNumber }
194194
set { self.set(value: newValue, for: TextAttribute.strokeWidth) }
195195
}
196196

197-
public var textEffect: NSString? {
197+
var textEffect: NSString? {
198198
get { return self.attributes[TextAttribute.textEffect.NSAttribute] as? NSString }
199199
set { self.set(value: newValue, for: TextAttribute.textEffect) }
200200
}
201201

202-
public var underlineColor: UIColor? {
202+
var underlineColor: UIColor? {
203203
get { return self.attributes[TextAttribute.underlineColor.NSAttribute] as? UIColor }
204204
set { self.set(value: newValue, for: TextAttribute.underlineColor) }
205205
}
206206

207-
public var underlineStyle: NSNumber? {
207+
var underlineStyle: NSNumber? {
208208
get { return self.attributes[TextAttribute.underlineStyle.NSAttribute] as? NSNumber }
209209
set { self.set(value: newValue, for: TextAttribute.underlineStyle) }
210210
}
211211

212-
public var verticalGlyphForm: NSNumber? {
212+
var verticalGlyphForm: NSNumber? {
213213
get { return self.attributes[TextAttribute.verticalGlyphForm.NSAttribute] as? NSNumber }
214214
set { self.set(value: newValue, for: TextAttribute.verticalGlyphForm) }
215215
}
216216

217-
public var writingDirection: [NSNumber]? {
217+
var writingDirection: [NSNumber]? {
218218
get { return self.attributes[TextAttribute.writingDirection.NSAttribute] as? [NSNumber] }
219219
set { self.set(value: newValue, for: TextAttribute.writingDirection) }
220220
}

Texty.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Texty'
3-
s.version = '0.2.5'
3+
s.version = '0.2.6'
44
s.summary = 'Enjoy clean and easy text styling using a simplified and structured syntax.'
55

66
s.description = <<-DESC
@@ -13,6 +13,7 @@ DESC
1313
s.author = { 'Vectorform' => 'jmeador@vectorform.com', 'Igor Efremov' => 'igor@efremov.io' }
1414
s.source = { :git => 'https://github.com/vectorform/Texty.git', :tag => s.version.to_s }
1515
s.social_media_url = 'https://twitter.com/vectorform'
16+
s.swift_versions = ['5.0']
1617

1718
s.ios.deployment_target = '8.0'
1819

Texty.xcodeproj/project.pbxproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,18 @@
184184
};
185185
F0E3719A1EAE82FF00BDEC7F = {
186186
CreatedOnToolsVersion = 8.3;
187-
LastSwiftMigration = 0900;
187+
LastSwiftMigration = 1130;
188188
ProvisioningStyle = Automatic;
189189
};
190190
};
191191
};
192192
buildConfigurationList = F0E371951EAE82FF00BDEC7F /* Build configuration list for PBXProject "Texty" */;
193193
compatibilityVersion = "Xcode 3.2";
194-
developmentRegion = English;
194+
developmentRegion = en;
195195
hasScannedForEncodings = 0;
196196
knownRegions = (
197197
en,
198+
Base,
198199
);
199200
mainGroup = F0E371911EAE82FF00BDEC7F;
200201
productRefGroup = F0E3719C1EAE82FF00BDEC7F /* Products */;
@@ -440,7 +441,7 @@
440441
SKIP_INSTALL = YES;
441442
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
442443
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
443-
SWIFT_VERSION = 4.0;
444+
SWIFT_VERSION = 5.0;
444445
};
445446
name = Debug;
446447
};
@@ -460,7 +461,7 @@
460461
PRODUCT_NAME = "$(TARGET_NAME)";
461462
SKIP_INSTALL = YES;
462463
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
463-
SWIFT_VERSION = 4.0;
464+
SWIFT_VERSION = 5.0;
464465
};
465466
name = Release;
466467
};

0 commit comments

Comments
 (0)