Skip to content

Commit a06ece4

Browse files
author
Coen Wessels
committed
Converted to Swift 2
1 parent c11e489 commit a06ece4

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

SwiftBox/Layout+View.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension Layout {
2222
view.frame = CGRectIntegral(frame)
2323

2424
for (s, layout) in Zip2(view.subviews, children) {
25-
let subview = s as! ViewType
25+
let subview = s as ViewType
2626
layout.apply(subview)
2727
}
2828
}

SwiftBox/Layout.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ public struct Layout {
2222
}
2323
}
2424

25-
extension Layout: Printable {
25+
extension Layout: CustomStringConvertible {
2626
public var description: String {
2727
return descriptionForDepth(0)
2828
}
2929

3030
private func descriptionForDepth(depth: Int) -> String {
3131
let selfDescription = "{origin={\(frame.origin.x), \(frame.origin.y)}, size={\(frame.size.width), \(frame.size.height)}}"
3232
if children.count > 0 {
33-
let indentation = reduce(0...depth, "\n") { accum, _ in accum + "\t" }
33+
let indentation = (0...depth).reduce("\n") { accum, _ in accum + "\t" }
3434
let childrenDescription = indentation.join(children.map { $0.descriptionForDepth(depth + 1) })
3535
return "\(selfDescription)\(indentation)\(childrenDescription)"
3636
} else {

SwiftBox/Node.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public struct Node {
112112
}
113113

114114
/// Lay out the receiver and all its children with an optional max width.
115-
public func layout(maxWidth: CGFloat? = nil) -> Layout {
115+
public func layout(maxWidth maxWidth: CGFloat? = nil) -> Layout {
116116
let node = createUnderlyingNode()
117117
if let maxWidth = maxWidth {
118118
node.layoutWithMaxWidth(maxWidth)

SwiftBoxTests/SwiftBoxTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SwiftBoxTests: XCTestCase {
2828
])
2929

3030
let layout = parent.layout()
31-
XCTAssert(count("\(layout)".utf16) > 0, "Has a description.")
31+
XCTAssert("\(layout)".utf16.count > 0, "Has a description.")
3232
}
3333

3434
func testSizeParentBasedOnChildren() {

0 commit comments

Comments
 (0)