Where can I get CommonCrypto / CommonCrypto file from?

北战南征 提交于 2019-11-29 11:40:27

No additional files are required. You need a bridging header first of all, which you already have but for those who don't the easiest way to achieve this is to add an Objective-C file to your project and to accept when it offers to create a bridging header. You can then either import the whole of CommonCrypto (thanks @zaph - see comments) to the bridging header:

#import <CommonCrypto/CommonCrypto.h>

Or the constituent parts:

#import <CommonCrypto/CommonCryptor.h>
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonHMAC.h>
#import <CommonCrypto/CommonKeyDerivation.h>
#import <CommonCrypto/CommonSymmetricKeywrap.h>

You can now use CommonCrypto in Swift. For example code see here.

Edit

In Xcode 10 a bridging header is no longer required to import CommonCrypto in Swift. You can simply use:

import CommonCrypto

In fact, you don't need to compile any file to using CommonCrypto, just import it in your project.

or using some wrapper in Swift, just like https://github.com/soffes/Crypto

Let's back to CommonCrypto file,Apple have released it's source code in https://opensource.apple.com/source/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!