Skip to content
This repository has been archived by the owner on Aug 22, 2018. It is now read-only.

Swift 2 migration blog post #52

Closed
ashfurrow opened this issue Aug 27, 2015 · 4 comments
Closed

Swift 2 migration blog post #52

ashfurrow opened this issue Aug 27, 2015 · 4 comments

Comments

@ashfurrow
Copy link
Contributor

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
Copy link
Contributor Author

This PR: artsy/eidolon#496

Ran the converter, which failed shortly after beginning.

Further ideas:

  • isEmpty could have a corresponding isNotEmpty. (Done)
  • OptionSets are cool 👍
  • isEmpty should be able to be used on optional strings. (Done)
  • UITextField has optional text property.
  • No longer have to cast with objc generic arrays
  • FLKAutoLayout/our own libraries could use objc generic arrays
  • SSL thingy
  • Quick/Nimble update was painless 🌟 only change: https://github.com/artsy/eidolon/pull/496/files#diff-99681ae03e7455abb84f2358ea7ae5f2R9
  • As long as none of the Kiosk iPads are updated to iOS 9, we're fine.
  • Operator precedence in RAC macros.

@modocache
Copy link

Quick/Nimble update was painless 🌟

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

@ashfurrow
Copy link
Contributor Author

🙇 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
Copy link
Contributor Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants