Skip to content

Fluent 2.0 Alpha 4

Pre-release
Pre-release

Choose a tag to compare

@loganwright loganwright released this 17 Feb 14:34

New:

  • Storable base to allow easier protocol extensions
  • IdKey conveniences

Changed:

  • Fluent now enforces reference types, use final class in place of struct on existing conformers.
  • Swift 3.1

Warning:

  • id and exists are now implemented natively by Fluent, this means a few changes are required. All instances of var id: Node? and var exists on models MUST be deleted for Fluent to function properly.
  • if you are setting id manually in initializers, it MUST happen AFTER the initialization to function properly. In practice, this means usually put id = ... at the BOTTOM of your initializer if you need to do it.
let name: String

init(node: Node, in context: Context) throws {
    id = try node.extract("id") // will fail
    name = try node.extract("name")
}

=>

let name: String

init(node: Node, in context: Context) throws {
    name = try node.extract("name")
    // called after initialization proper
    id = try node.extract("id")
}

#181