artsy / mobile

Mobile Team TODO
http://www.objc.io/issues/22-scale/artsy/
84 stars 11 forks source link

Swift 2 migration blog post #52

Closed ashfurrow closed 8 years ago

ashfurrow commented 8 years ago

Expectations vs reality, sore spots, easy wins, ways to avoid hard times migrating to Swift 2.1, reasons why to/to not migrate now, lessons learnt.

ashfurrow commented 8 years ago

This PR: https://github.com/artsy/eidolon/pull/496

Ran the converter, which failed shortly after beginning.

Further ideas:

modocache commented 8 years ago

Quick/Nimble update was painless :star2:

Great!! Feedback always appreciated on other sore spots, feature requests, etc.

ashfurrow commented 8 years ago

:bow: Thanks Brian!

As for the isNotEmpty on (optional?) strings, the solution isn't that complex:

public protocol Occupiable {
    var isEmpty: Bool { get }
    var isNotEmpty: Bool { get }
}

public extension Occupiable {
    public var isNotEmpty: Bool {
        return !isEmpty
    }
}

extension String: Occupiable { }

public extension Optional where Wrapped: Occupiable {
    var isNilOrEmpty: Bool {
        return self?.isEmpty ?? false
    }

    var isNotNilNotEmpty: Bool {
        return !isNilOrEmpty
    }
}

I just don't know if this is a good idea. I mean, why not, eh? But it doesn't seem very idiomatic.

ashfurrow commented 8 years ago

Also, need to remove public everywhere. We have @testable now.