Mr Bonjour
Mr Bonjour

Reputation: 3400

challenged typecasting in swift

I'm trying to assign an object from a callBack: here is the method in obj-c:

 [SKeyBoardChange keyBoardChangeForActiveField:^(UIView* __autoreleasing *viewControlleurFrame,
                                                    UIScrollView* __autoreleasing *scrollView,
                                                    UIView* __autoreleasing *activeField) {
        *viewControlleurFrame = this.view;
        *scrollView   = this.uomTableView;
        *activeField  = this.activeField;
    }];

Now i'm trying to use it in my swift program, I can't make it works because of the compiler:

FTKeyBoardChangeNotifier.sharedFTKeyBoardChangeNotifier().keyBoardChangeForActiveField {
        (mainView, scrollview, activeField) -> Void in

//  where mainView is: AutoreleasingUnsafeMutablePointer<UIView?>
            mainView = /* ??? when I'm trying to assign it, the compiler really don't help me. */

    }

Can someone help me? I can't find any documentation on how typecast this kind o things. Thanks!

Upvotes: 0

Views: 49

Answers (1)

matt
matt

Reputation: 536027

Assign your view to mainView.memory. (And similarly for the other parameters.) That is the Swift equivalent of the *mainView syntax from Objective-C.

Upvotes: 1

Related Questions