Open dmoss18 opened 7 years ago
You can register your resources in AppDelegate.swift.
import UIKit
import Spine
let serializer = Serializer()
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
serializer.registerResource(MessageModel.self)
serializer.registerResource(UserModel.self)
return true
}
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
return true
}
}
I'm following your example resource class in the README:
but when I build I get the error "Expressions are not allowed at the top level" on the
registerResource
line.So where is the best place to register resources?
Also, where is the best place to instantiate Spine? Do you recommend a static sharedInstance property on a service class? Or the AppDelegate?