Goal: to master the ObjC <--> Swift API syntax
Problem: Working with multi-parameter function API.
I haven't been doing ObjC in years and now I need to interface ObjC with Swift packages.
Here's the Swift-Package code:
import Foundation
public struct RicStruct {
public private(set) var text = "Hello, World!"
public init() {}
public func sayHello() -> String {
"Hello Ric!"
}
}
public class RicClass: NSObject {
@objc public var msg = "Mother has a feeling, I might be too appealing."
@objc public let text = "Hello Everybody!"
override public init() {}
@objc public func sayHello() {
print(text)
}
@objc public func doSomething(msg: String) {
print("Inside doSomething: \(msg)")
}
@objc public func doSomething(msg: String, answer: String) {
print("Inside doSomething with msg: \(msg) and answer: \(answer)")
}
@objc public func sayHelloTo(whom: String) -> String {
"Hello \(whom)!"
}
}
I'm having trouble with the multi-parameter syntax.
Objective-C likes to append 'with' or 'to', etc. to parameter names. I've learned this via trial & error.
But I'm having trouble with the multi-parameter syntax:
Question: What's the correct syntax for multi-parameter Objective-C method calls?