0

I am trying to use Cryptor in Swift for iOS.

Random.swift contains the line import CommonCrypto which doesn't work for me. Somewhere I've read that CommonCrypto doesn't offer access to Swift classes so I created a bridging header.

The import still wasn't working but when I import UIKit to my Bridging Header it is available in my Swift class so I thought another import isn't necessary. However, CommonCrypto's CCRandomGenerateBytes still gives me an Use of unresolved identifier when called in Swift. Is there anything I am missing?

With import of CommonCrypto in Swift file enter image description here

Without import of CommonCrypto in Swift file enter image description here

user2330482
  • 1,053
  • 2
  • 11
  • 19

1 Answers1

3

Add #import <CommonCrypto/CommonRandom.h> to your Bridging Header file.

  • Bro thanks a ton, can't yet tell if it's usable now but I added CommonRandom and after cleaning the project and re-building, all errors disappeared, seems to have solved :) – user2330482 Jan 26 '18 at 13:59