When calling the Objective-C method from Swift, if the argument is pointer **, how should I call it?
objective-c swift
For example,
- NSData initWithContentsOfURL: (NSURL*)aURL
options: (NSDataReadingOptions) mask
error: (NSError**) errorPtr]
This is
let url:NSURL=//NSURL instance
varerror: Declared as NSError?=nil//var.make optional
let data = NSData(contentsOfURL:url, options:.DataReadingMappedIfSafe, error: & error)
will look like this
Apple publication Using Swift with Cocoa and Objective-C (link is Apple Developer's site with the same content).
Interacting with CAPIs → Pointers section of this e-book.
C Syntax:Type**
Swift Syntax:AutoreleasingUnsafeMutablePointer<Type>
and so on.
However, you can't tell what to do without looking at the actual program code.To be honest, I'm confused and still don't understand.
© 2024 OneMinuteCode. All rights reserved.