[ad_1]
I am a brand new comer into Goal-C and swift and I must make adjustments to an current code base.
I’ve added a protocol outlined in Swift
File AController.swift
@objc
protocol MyDelegate: NSObjectProtocol {
func saveTapped()
func discardTapped()
}
@objc
class AController: UIViewController, BcAiDelegate {
...
}
The protocol is used as a member is BController.h
and the code compiles and builds w/o points
// imports are positioned right here
// @class declarations are right here
@protocol MyDelegate;
...
@property (nonatomic) MyDelegate* myDelegate;
@property (nonatomic) BOOL myFlag;
After which I attempt to entry this discipline in CController.swift
@objcMembers class CController: UIViewController {
...
func doSomething() {
let bController = BController()
// When I attempt to entry `myDelegate` it is not acknowledged as a member of the controller
// I get an error message that claims - Worth of kind 'BController' has no member 'myDelegate'
bController.myDelegate = nil
bController.myFlag = true // This strains works high-quality
}
...
}
If I take a look at the swift 5 interface generated from BController.h I can see the next definitions:
...
open var myDelegate: UnsafeMutablePointer<Int32>!
open var myFlag: Int33
...
I attempted created new initializers in BController.h, one which receives a Bool and the opposite that receives MyDelegate – and the conduct is identical, the one with Bool is accessible in CController.swift and the opposite is not
Clearly I am lacking some half – however what?
[ad_2]
