Last active
January 23, 2022 19:08
-
-
Save paulw11/7772e98743bcf39407e2bad884018330 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Passbase | |
class MyPassbaseWrapper { | |
static func initialisePassbase:(_ apiKey: String) { | |
PassbaseSDK.initialize(publishableApiKey: apiKey) | |
} | |
} |
That’s not correct. My first code was correct. apiKey
is the parameter passed to the function. You could add a -> Void
return type to the function, but it doesn’t return a string.
You might also need to add the @objc
decorator to the function.
ok... will try. Thank you!
These are the errors I get without making any changes to your code:
::ERROR:: swiftWrapper.swift:14:40: Expected '(' in argument list of function declaration
Current code: @objc static func initialisePassbase:(_ apiKey: String)
Xcode suggested change(fix): @objc static func initialisePassbase():(_ apiKey: String)
::ERROR:: swiftWrapper.swift:14:40: Expected '->' after function parameter tuple
Current code: @objc static func initialisePassbase:(_ apiKey: String)
Xcode suggested change(fix): @objc static func initialisePassbase -> (_ apiKey: String)
::ERROR:: swiftWrapper.swift:14:42: Tuple element cannot have two labels
Current code: @objc static func initialisePassbase:(_ apiKey: String)
Xcode suggested change(fix): @objc static func initialisePassbase:(String)
::ERROR:: swiftWrapper.swift:15:51: Cannot find 'apiKey' in scope
Current code: PassbaseSDK.initialize(publishableApiKey: apiKey)
Xcode suggested change(fix): NONE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for helping me... I'm primarily an ObjC guy... I'm lacking in my understanding of Swift, unfortunately... learning though.
I'm working with this code you provided and I got a few errors. I made the suggested changes to this:
Getting this error for "apiKey"... Swift Compiler Error: Cannot find 'apiKey' in scope
Unsure how to proceed.