Objective C signature to Swift

已查看 80 次
跳至第一个未读帖子

Wimpie Pieterse

未读,
2014年8月3日 17:04:302014/8/3
收件人 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

未读,
2014年8月3日 17:57:482014/8/3
收件人 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

未读,
2014年8月3日 18:09:342014/8/3
收件人 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

未读,
2014年8月3日 18:25:072014/8/3
收件人 swift-l...@googlegroups.com
Thank you so much.. I implemented this easily. Works like a charm
回复全部
回复作者
转发
0 个新帖子