OMG, for the life of me I can't get this to work.
- I've got a
typdef
in objective-c that looks like this:
typedef void (^StringBlock)(NSString * string);
- I've got an objective-c class that has a property that allows you to store your own block of
StringBlock
type. That property is declared in objective-c like this:
@property (nonatomic, copy) StringBlock onTextSubmitBlock;
- Assigning a block to it in objective-c looks like this:
input.onTextSubmitBlock = ^(NSString * text) {
};
- I want to do the same thing from within a Swift class! The closest I've come to having something that works is this:
input!.onTextSubmitBlock = {(StringBlock) in
}
That compiles, but I have no access to the argument I need ((NSString * text)
in objective-c...)
I'm sure that once I get used to Swift this will be obvious, but what am I missing?