PrediKit v4.0.0 Release Notes

Release Date: 2016-09-19 // about 5 years ago
  • 👍 Not too much of an overhaul. However, in order to support Swift 3.0, there were a couple of changes that needed to be made.

    • ⚠ First off, the use of PrediKit in Swift 3 caused a bunch of unused result warnings. This has been fixed by assigning the @discardableResult attribute to any function that returned a FinalizableIncluder<T>. This change shouldn't affect anything you are already doing.
    • ⚠ One breaking change is to variables that returned a FinalizableIncluder<T> instance. These needed to be converted to functions since you can't mark variables with attributes. The unused result warnings wouldn't go away until I converted these variables to functions so I can mark them with @discardableResult attribute.

    If your code uses these variables (for example, the use of includeIf.string(property).isEmpty), then you need to add an open and close paren to the end of the variable.

    This means that current use of these variables will be returning a () -> FinalizableIncluder<T> function pointer instead of the result of the function. This may result in errors that look like this: "Binary operator '&&' cannot be applied to operands of type 'FinalizedIncluder' and '() -> FinalizedIncluder'". The fix is to simply tack on a () to the end of the closure operand value.

    • Another breaking change is the change of all includers to use Strings instead of Selectors. With the advent of Swift 3, I want to encourage you to use Swift 3's #keyPath() syntax to help you ensure the correctness of your property paths at compile time. Since #keyPath() returns a string value, it just made sense to switch over to using Strings now. However, this now gives you a chance to use PrediKit unsafely. Remember, with great power comes great responsibility. So I'll say it again:

    DON'T STRINGIFY YOUR PROPERTIES, USE #KEYPATH FOR HAPPINESS INSTEAD!