Objective C signature to Swift

80 views
Skip to first unread message

Wimpie Pieterse

unread,
Aug 3, 2014, 5:04:30 PM8/3/14
to swift-l...@googlegroups.com
Good Day,

I am struggling to convert this method signature to Swift:

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{...

Can someone please help?

Adam Sharp

unread,
Aug 3, 2014, 5:57:48 PM8/3/14
to swift-l...@googlegroups.com
This should work:

    func image(image: UIImage, didFinishSavingWithError error: NSErrorPointer, contextInfo: UnsafePointer<()>)

And alternatively this should be equivalent to NSErrorPointer:

    inout didFinishSavingWithError error: NSError

HTH

–Adam
--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swift-languag...@googlegroups.com.
To post to this group, send email to swift-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/972ddedb-44de-4e3e-bd09-9c0faf37a77e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marco S Hyman

unread,
Aug 3, 2014, 6:09:34 PM8/3/14
to Wimpie Pieterse, swift-l...@googlegroups.com
func image(image: UIImage,
didFinishSavingWithError: NSErrorPointer,
contextInfo: UnsafePointer<()>) {
// ...
}


I think. Void is represented as an empty tuple () so a void *
is an UnsafePointer<()>. Again, I think :)

Marc

Wimpie Pieterse

unread,
Aug 3, 2014, 6:25:07 PM8/3/14
to swift-l...@googlegroups.com
Thank you so much.. I implemented this easily. Works like a charm
Reply all
Reply to author
Forward
0 new messages