objective c - Unable to integrate ZXingObjC in a iOS Swift Project -


im working on ios project, shows customer number in barcode. had installed framework zxingobjc cocoapods, described in github.

i can compile project without errors. can use classes of zxingobjc in objective-c classes, without errors. after than, have added import command #import <zxingobjc/zxingobjc.h> bridging header file, other custom objective-c classes, without compile errors. (i had testet header file destroying import statements , got expected file not found exception.)

but now, can't use class of zxingobjc in swift classes. got following compile error: use of undeclared type '...'. xcode autocomplete not working, too.

e.g.

var test : zxmultiformatwriter? >> use of undeclared type 'zxmultiformatwriter' 

i tried:

  • setup new project, same issue
  • checked header search path: $(srcroot)/pods/headers/public/adjust
  • reinstalled zxingobjc framework
  • checked build settings: enable modules: yes
  • checked build settings: other linker flags: $(inherited) -objc -framework "zxingobjc"
  • checked linked binaries in build phases: framework added
  • checked import statement in bridging header file (#import <zxingobjc/zxingobjc.h> , #import "zxingobjc/zxingobjc.h" -- no difference)
  • windows style: restarting xcode , mac ;-)

i'm using:

  • xcode: 6.3.2
  • cocoapods: 0.37.2
  • project deployment target: ios 8.0
  • sdk: 8.3

does know problem? can help? how can make zxingobjc framework available in swift?

actually easy issue:

podfile

source 'https://github.com/cocoapods/specs.git'  platform :ios, '8.0' use_frameworks!  pod 'zxingobjc', '~> 3.1' 

so, on terminal:

cd workspace pod install 

then, once opened project on xcode, have edit bridging-header adding zxingobj:

#import <zxingobjc/zxingobjc.h> 

finally, in swift classes uses zxingobjc, have import zxingobjc.

import zxingobjc  class zxingobjcwrapper {      func encode() {        let writer = zxmultiformatwriter.writer()                ....     }  } 

Comments