TextGeneration - aiXpertLab/OpenAI-ChatGPT-Practices GitHub Wiki
Everything has a beginning. For learning ChatGPT, it's Text Generation.
Installation
Swift Package Manager
- Select File > Swift Packages > Add Package Dependency. Enter
https://github.com/onevcat/Kingfisher.git
in the "Choose Package Repository" dialog. - In the next page, specify the version resolving rule as "Up to Next Major" with "7.0.0" as its earliest version.
- After Xcode checking out the source and resolving the version, you can choose the "Kingfisher" library and add it to your app target.
If you encounter any problem or have a question on adding the package to an Xcode project, I suggest reading the Adding Package Dependencies to Your App guide article from Apple.
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate Kingfisher into your Xcode project using CocoaPods, specify it to a target in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.0'
use_frameworks!
target 'MyApp' do
# your other pod
# ...
pod 'Kingfisher', '~> 7.0'
end
Then, run the following command:
$ pod install
You should open the {Project}.xcworkspace
instead of the {Project}.xcodeproj
after you installed anything from CocoaPods.
For more information about how to use CocoaPods, I suggest this tutorial.
Carthage
Carthage is a decentralized dependency manager for Cocoa application. To install the carthage tool, you can use Homebrew.
$ brew update
$ brew install carthage
To integrate Kingfisher into your Xcode project using Carthage, specify it in your Cartfile
:
github "onevcat/Kingfisher" ~> 7.0
Then, run the following command to build the Kingfisher framework:
$ carthage update Kingfisher --platform iOS
# Or `--platform macOS`, `--platform tvOS`, `--platform watchOS`
At last, you need to set up your Xcode project manually to add the Kingfisher framework:
-
On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.
-
On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:
/usr/local/bin/carthage copy-frameworks
- Add the paths to the frameworks you want to use under “Input Files”:
$(SRCROOT)/Carthage/Build/iOS/Kingfisher.framework
- Add the paths to the copied frameworks to the “Output Files”:
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Kingfisher.framework
Manually
It is not recommended to install the framework manually, but if you prefer not to use either of the aforementioned dependency managers, you can integrate Kingfisher into your project manually. A regular way to use Kingfisher in your project would be using the Embedded Framework.
- Add Kingfisher as a submodule. In your favorite terminal,
cd
into your top-level project directory, and entering the following command:
$ git submodule add https://github.com/onevcat/Kingfisher.git
- The master branch of Kingfisher project is under active development and it may break time to time. So I suggest always use a tagged version whenever possible. Remember to replace the version number to the one you want to use.
cd Kingfisher && git checkout 7.0.0
- Open the
Kingfisher
folder in Finder, and dragKingfisher.xcodeproj
into the file navigator of your app project, under your app project in Xcode. - In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
- In the tab bar at the top of that window, open the "Build Phases" panel.
- Expand the "Target Dependencies" group, and add
Kingfisher.framework
. - Click on the
+
button at the top left of "Build Phases" panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and addKingfisher.framework
of the platform you need.
Next
After installation, you could import Kingfisher to your project by adding this:
import Kingfisher
to the files in which you want to use Kingfisher.
Once you prepared, continue to have a look at the Cheat Sheet to see how to use Kingfisher.