Skip to content

Commit 38ca363

Browse files
committed
logical-or bug fixed in Swift 1.3, remove helper function
1 parent 1cec690 commit 38ca363

File tree

5 files changed

+5
-36
lines changed

5 files changed

+5
-36
lines changed

bk2ch10p509attributedStringDrawing/ch23p773attributedStringDrawing.xcodeproj/project.pbxproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
/* Begin PBXBuildFile section */
1010
32C95B6C198B3EC300708AC3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C95B6B198B3EC300708AC3 /* ViewController.swift */; };
11-
32C95B6D198B42C500708AC3 /* StringDrawer.m in Sources */ = {isa = PBXBuildFile; fileRef = C9A50D9E1810085000F5B6CE /* StringDrawer.m */; };
1211
32C95B6F198B457A00708AC3 /* StringDrawer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C95B69198B3D3300708AC3 /* StringDrawer.swift */; };
1312
C9A50D69180F835200F5B6CE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9A50D68180F835200F5B6CE /* Foundation.framework */; };
1413
C9A50D6B180F835200F5B6CE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9A50D6A180F835200F5B6CE /* CoreGraphics.framework */; };
@@ -37,8 +36,6 @@
3736
C9A50D7B180F835200F5B6CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
3837
C9A50D80180F835300F5B6CE /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
3938
C9A50D87180F835300F5B6CE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
40-
C9A50D9D1810085000F5B6CE /* StringDrawer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringDrawer.h; sourceTree = "<group>"; };
41-
C9A50D9E1810085000F5B6CE /* StringDrawer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StringDrawer.m; sourceTree = "<group>"; };
4239
/* End PBXFileReference section */
4340

4441
/* Begin PBXFrameworksBuildPhase section */
@@ -90,8 +87,6 @@
9087
C9A50D78180F835200F5B6CE /* AppDelegate.m */,
9188
C9A50D7A180F835200F5B6CE /* Main.storyboard */,
9289
32C95B6B198B3EC300708AC3 /* ViewController.swift */,
93-
C9A50D9D1810085000F5B6CE /* StringDrawer.h */,
94-
C9A50D9E1810085000F5B6CE /* StringDrawer.m */,
9590
32C95B69198B3D3300708AC3 /* StringDrawer.swift */,
9691
32C95B6E198B437B00708AC3 /* Bridge.h */,
9792
C9A50D80180F835300F5B6CE /* Images.xcassets */,
@@ -178,7 +173,6 @@
178173
files = (
179174
32C95B6C198B3EC300708AC3 /* ViewController.swift in Sources */,
180175
32C95B6F198B457A00708AC3 /* StringDrawer.swift in Sources */,
181-
32C95B6D198B42C500708AC3 /* StringDrawer.m in Sources */,
182176
C9A50D79180F835200F5B6CE /* AppDelegate.m in Sources */,
183177
C9A50D75180F835200F5B6CE /* main.m in Sources */,
184178
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#import "StringDrawer.h"
1+

bk2ch10p509attributedStringDrawing/ch23p773attributedStringDrawing/StringDrawer.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

bk2ch10p509attributedStringDrawing/ch23p773attributedStringDrawing/StringDrawer.m

Lines changed: 0 additions & 21 deletions
This file was deleted.

bk2ch10p509attributedStringDrawing/ch23p773attributedStringDrawing/StringDrawer.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ class StringDrawer : UIView {
1414
// unfortunately there's a huge bug in Swift:
1515
// we can't "or" NSStringDrawingOptions values together
1616
// I've resorted to the assistance of Objective-C
17-
let opts = NSString.combine(.TruncatesLastVisibleLine, with:.UsesLineFragmentOrigin)
17+
// let opts = NSString.combine(.TruncatesLastVisibleLine, with:.UsesLineFragmentOrigin)
1818
// let opts = NSStringDrawingOptions.UsesLineFragmentOrigin
1919

20+
// fixed in Swift 1.2 / Xcode 6.3!
21+
let opts : NSStringDrawingOptions = .TruncatesLastVisibleLine | .UsesLineFragmentOrigin
22+
2023
let context = NSStringDrawingContext()
2124
context.minimumScaleFactor = 0.5 // does nothing
2225

0 commit comments

Comments
 (0)