ReactKit / SwiftState

Elegant state machine for Swift.
MIT License
904 stars 93 forks source link

Migrate SwiftState to Swift 1.2 #15

Closed cakper closed 9 years ago

cakper commented 9 years ago

Hello!

I've migrated SwiftState to Swift 1.2 and now the machine builds and tests are passing under Xcode 6.3 beta.

Unfortunately due to the changes in language I had to cut some features as they are not longer supported by the language. In particular we are affected by changes in autoclosures as described here: http://mazur.me/SwiftInFlux/docs/6.3-beta1.pdf

The @autoclosure attribute on parameters now implies the new @noescape attribute. This intentionally limits the power of @autoclosure to control-flow and lazy evaluation use cases.

A new “@noescape” attribute may be used on closure parameters to functions. This indicates that the parameter is only ever called (or passed as an @noescape parameter in a call), which means that it cannot outlive the lifetime of the call. This enables some minor performance optimizations, but more importantly disables the “self.” requirement in closure arguments. This enables control-flow-like functions to be more transparent about their behavior. In a future beta, the standard library will adopt this attribute in functions like autoreleasepool(). (16323038)

This means that condition autoclosures passed to all addRoute*() methods cannot be passed and outlive the call. Hope I understood it correctly.

All the other changes are quite minor and I hope make sense. This PR should fix #14 raised by @mkoppanen

cakper commented 9 years ago

I suggest closing this PR as it point to wrong branch. New one here: #16