How to Import Zbar Framework in Swift Project

How to import Zbar Framework in Swift Project

Here is the solution

following link helped me
https://stackoverflow.com/a/24005242/4059179

But after that I had NSEnumeration Problem so here second problem solution

func imagePickerController(picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [NSObject : AnyObject]){
var results: NSFastEnumeration = info[ZBarReaderControllerResults] as NSFastEnumeration
}

Don't forget to extend

extension ZBarSymbolSet: SequenceType { public func generate() -> NSFastGenerator { return NSFastGenerator(self) } 
}

Using zbar sdk and converting to swift 3, will it work?

The only changes should be the protocol part, you may refer to this post.

How to import Zbar Framework in Swift Project

extension ZBarSymbolSet: Sequence {
public func makeIterator() -> NSFastEnumerationIterator {
return NSFastEnumerationIterator(self)
}
}

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
// ADD: get the decode results
let results: NSFastEnumeration = info[ZBarReaderControllerResults] as! NSFastEnumeration

var symbolFound : ZBarSymbol?

for symbol in results as! ZBarSymbolSet {
symbolFound = symbol as? ZBarSymbol
break
}
let resultString = symbolFound!.data
print(resultString)
}

Swift Import Obj-C Framework

You need to add libstdc++.dylib to the Linked Frameworks and Libraries in the General tab for your project.

Using an Obj-C sub-project in a Swift application

I followed the HockeyApp tutorial that can be found here:
http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/integrate-hockeyapp-for-ios-as-a-subproject

In the end, I was on the right tracks but messed up the Header Search Paths:

  1. Add subproject xcodeproj to the workspace
  2. On the main project : Link binary with library, and add the subproject product library (Bonus points : add it as a target dependency too)
  3. Update Header Search Paths (not User Header Search Paths) accordingly
  4. Import your Library.h in the main project Bridging-Header.h file


Related Topics



Leave a reply



Submit