Cocoanetics / BarCodeKit

A modern framework for generating 1D barcodes
Other
87 stars 18 forks source link

Declare deprecated init method NS_SWIFT_UNAVAILABLE #7

Closed robertmryan closed 5 years ago

robertmryan commented 5 years ago

I'd suggest declaring this deprecated (and apparently unimplemented!) method as NS_SWIFT_UNAVAILABLE. The presence of this method declaration is interfering with Swift bridging.

robertmryan commented 5 years ago

FYI, in case you're wondering why I did this, you really should be able to write Swift code like:

do {
    let barcode = try BCKEAN8Code(content: string)
    imageView.image = UIImage(barCode: barcode, options: nil)
} catch {
    print(error)
}

But the presence of this deprecated header is preventing that from working correctly. By marking this deprecated method as being unavailable to Swift, the compiler can correctly deduce that it should use - [initWithContents:error:] instead.

Sabbir1234 commented 3 years ago

robertmryan , Thank you so much

israkul9 commented 3 years ago

robertmryan , Thanks Dude