wvteijlingen / Spine

A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
MIT License
264 stars 109 forks source link

Swift 4 Update #195

Closed kelvinlauKL closed 6 years ago

kelvinlauKL commented 6 years ago

Work in progress

This PR migrates the framework to Swift 4.

Brief description of changes

Updates to generics

Removed many generic constraints based on Resource. Xcode 9 compiler warns of the unneeded constraint:

// before
func foo<T: Resource> // ...

// after
func foo<T> // ...

Updated Podspec

Updated dependencies to use latest versions

kelvinlauKL commented 6 years ago

@wvteijlingen The framework builds, but some tests aren't passing. Could you take a look?

kelvinlauKL commented 6 years ago

Currently stuck on line 147 of the Resource class.

setValue(value, forKey: field)

caught "NSUnknownKeyException", "[<Spine_iOSTests.Foo 0x7f9048418b50> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key booleanAttribute."

kelvinlauKL commented 6 years ago

Fixed in d8ca355. Swift 4 no longer generates the Objective-C interfaces for Swift classes, so we needed @objcMembers attribute to the Resource class to support it.