Search code examples
iosswiftloopbackjsstrongloop

Strongloop loopback ios swift sdk override repository error


I am usign strongloop's loopback ios sdk.Running XCode 6.3.

Objective: To create an instance of custom LBUser model class from custom LBUserRepository.

Code:

class UserProfileRepository : LBUserRepository
{
    override class func repository() -> UserProfileRepository {
        let repo = UserProfileRepository(className: "userprofiles")
        return repo
    }
}

Error: I get an error: Cannot override 'repository' which has been marked unavailable Why is this error coming ? is it a swift error in newer version?

References: Apart from official documentation, I am doing it the same way as it is depicted here : Strongloop iOS User Creation Error and also I have even seen exact code in the test cases of obj c to swift converted code: https://github.com/Black-Tobacco/loopback-sdk-ios/tree/swift


Solution

  • I had the same problem and solved it like this:

    class ClientRepository:LBUserRepository {
        override init!(className name: String!) {
             super.init(className: "Clients")
        }
    }