I want to read a .csv data in Swift, so I have informed me how to make this. Finally I got into this: https://github.com/Flinesoft/CSVImporter The CSVImporter.
But it says: "You can of course also just include this framework manually into your project by downloading it".
That would be OK, but there are several folders and as I have never importer a library into Swift before, I don't know what to download and where I should include it into my project.
I hope, anybody can help me. Thanks.
To add a new Swift package dependency: Select your project in the Project navigator, then select your app target and navigate to its General pane. Click the + button in the "Frameworks, Libraries, and Embedded Content" section, select the local package's library product, and add it as a dependency.
To distribute code in binary form as a Swift package, create an XCFramework bundle, or artifact, that contains the binaries. Then, make the bundle available locally or on a server: When you host the binaries on a server, create a ZIP archive with the XCFramework in its root directory and make it available publicly.
The best way to import third-party dependencies is via dependency managers: CocoaPods/Carthage/SPM, you will be able to update a lib without headache.
1. CocoaPods [Offical Guide]
This is by far the easiest way to go...
Open terminal
Install CocoaPods (type in terminal):
sudo gem install cocoapods
Sudo means "super user do", it will require your password. Enter when requested.
Next, you need to setup the cocoapods master repo. Type in terminal:
pod setup --verbose // verbose option logs the setup progress
then create a pod file in your project directory (you can type "cd " and drag the project folder to the terminal window if your not comfortable with writing the path):
cd User/Projects/YourProject // make way to your project dir
pod init
then inside the Podfile (find it in project directory) insert:
platform :ios, '8.0'
use_frameworks!
target 'YouAppTarget' do
pod 'CSVImporter', '~> 1.7'
end
(Uncomment platform :ios, '8.0' Uncomment user_frameworks! if you're using Swift)
Run (while in your project dir):
pod install
Xcode .xcworkspace file will be generated, thats it, you can open it and use the framework ;]
later on you can update lib with:
pod update
2. Carthage [Offical Guide]
Steps to install a framework via Carthage are pretty similar to CocoaPods, follow the 'Offical Guide' link to see what's the differences are. A downside about this dependency manager is that not all libs are available. Some are only available for CocoaPods, but majority of new ones are supporting Carthage. P.S. Here's a good article on the differences.
3. Swift Package Manager [Offical Overview/Guide]
SPM is a native dependency manager, it's cross-platform, officaly-supported by Apple, decentralized and open-source.
It was planned as a replacement for CocoaPods and Carthage so I'd give it a try too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With