Objective C signature to Swift

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Objective C signature to Swift

Wimpie Pieterse
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?

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Objective C signature to Swift

Adam Sharp
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

On 4 Aug 2014, at 7:04 am, Wimpie Pieterse <[hidden email]> wrote:

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?

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/2975081A-8D5D-48C2-925D-5F864C7F8915%40me.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Objective C signature to Swift

Marco S Hyman
In reply to this post by Wimpie Pieterse
On Aug 3, 2014, at 2:04 PM, Wimpie Pieterse <[hidden email]> wrote:

> I am struggling to convert this method signature to Swift:
>
> - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{...
>
> Can someone please help?

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

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/E195C04E-BCD4-4F52-B556-067ACFE72700%40snafu.org.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Objective C signature to Swift

Wimpie Pieterse
In reply to this post by Adam Sharp
Thank you so much.. I implemented this easily. Works like a charm

On Sunday, August 3, 2014 11:57:48 PM UTC+2, Adam Sharp wrote:
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

On 4 Aug 2014, at 7:04 am, Wimpie Pieterse <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="31NBLmqPwpEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">wimpie....@...> wrote:

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?

--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="31NBLmqPwpEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">swift-languag...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="31NBLmqPwpEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">swift-l...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/swift-language/972ddedb-44de-4e3e-bd09-9c0faf37a77e%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/swift-language/972ddedb-44de-4e3e-bd09-9c0faf37a77e%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/swift-language/972ddedb-44de-4e3e-bd09-9c0faf37a77e%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/swift-language/972ddedb-44de-4e3e-bd09-9c0faf37a77e%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/f6e22113-8a29-4904-a397-1bca74fec20f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.