user3847113 user3847113 - 1 month ago 29
iOS Question

Install SwiftKeychainWrapper manually

I would like to install SwiftKeychainWrapper manually because I get error when I try to install it using CocoaPods.

In description it says that I need to download and drop

KeychainWrapper.swift
and
KeychainItemAcessibility.swift
into my project.

I clicked on Clone or download -> Download ZIP. In downloaded SwiftKeychainWrapper folder there are
KeychainWrapper.swift
and
KeychainItemAcessibility.swift
files. I drag and dropped them to my project under the same root where there are Main.storyboard, AppDelegate.swift,...

Then is says to use the keychain wrapper in your app, import SwiftKeychainWrapper into the file(s) where you want to use it.

I added
import SwiftKeychainWrapper
to a file where I want to use it and I get error
No such module 'SwiftKeychainWrapper'
.

What am I doing wrong, why can't I use it?

Answer

Just as @dan said you don't need to import any other modules if you add source files directly to your project. When a library is added via cocoapods, all of it's sources are in a separate module and you need to do import ModuleName to make them accessible.

If your read carefully github instructions, you'll find that for manual approach you should only copy the files and nothing more:

Manually

Download and drop KeychainWrapper.swift and KeychainItemAcessibility.swift into your project.

P.S. Also make sure that you copy those files into you project folder before dragging them into Xcode because that will just add links to files in your Downloads folder or wherever they are placed.

Comments