Search code examples
objective-cswiftfunctionoverridingnon-nullable

Objective C to Swift Nonnull conversion


Im converting some code from Objective C.

-(nonnull NSString*) endpoint {
    return @"LoginRequest";
}

The Swift converter produces

func endpoint() -> nonnull NSString {
    return "LoginRequest"
}

However nonnull is not recognised by swift. This should also be an overrider function.

I believe it should be along the lines of

   override func endpoint() -> NSString {
    return "LoginRequest"
    }

but it brings up an error. Method does not override any Method from its superclass. I shouldnt need to remove the override, if I do, it conflicts with the original in the Objective C imported library.

Could you help please?


Solution

  • solved it

    override func endpoint() -> String {
      return "LoginRequest"
    }