A dependency manager for iOS, tvOS, watchOS and macOS projects. Includes support for CocoaPods/Carthage/SwiftPM; handles dynamic frameworks like WatchKit; supports Swift 4.2+
The “swift package manager build for ios” is a tool that manages dependencies of iOS, tvOS, watchOS and macOS projects. It uses SwiftPM as its dependency manager.
• Installing • Using • Using Accio • Contributing • Using Accio • Using Accio • Using Accio • Using A
Notice of Deprecation
With the release of Xcode 12, which incorporates Swift 5.3, we believe there is no longer a need for Accio to fill in the transition to SwiftPM, therefore we are deprecating support for Accio in those versions. Instead, please utilize Xcode’s built-in SwiftPM functionality. These features were recently introduced to SwiftPM:
A SwiftPM-based dependency management for iOS, tvOS, watchOS, and macOS applications.
Pronunciation
Because this is a frequently asked topic, this is the official pronunciation of this library’s name: “AH-kee-oh.”
While there are differing viewpoints, the official films (as shown in this video), this Harry Potter Wiki page, and many latin supporters seem to favor the above pronunciation.
Requirements
- Swift 5.0-5.2 and Xcode 10.0-11.7
- Command Line Tools for Xcode (see here for installation instructions)
- 0.32+ Carthage (click here to download)
Installation
courtesy of Homebrew:
Run the following commands to install Accio for the first time:
JamitLabs/Accio brew tap brew install accio https://github.com/JamitLabs/Accio.git
Instead, run this to get the most recent version:
Via Mint:
Run the following command to install Accio or upgrade to the current version:
install mint JamitLabs/Accio
Why would I want to utilize this?
TL;DR: It is aimed at SwiftPM’s integration with Xcode and provides several enhancements over Carthage.
Read this blog article to discover more about Accio’s motivation, reasoning, and design.
Alternatively, read the expanded overview below:
Summary of Motivation and Benefits
CocoaPods and Carthage, two well-known dependency managers for Apple platforms, are already in use by developers. If you like the way CocoaPods handles things, you’ll probably never need to use Accio. It does nothing that CocoaPods does not.
However, if you’re one of the many developers who like Carthage since it’s built in Swift (rather than Ruby) and doesn’t generate an Xcode workspace but is rather unobtrusive, you may find that Accio addresses some of the issues you’ve had with Carthage.
Currently, Accios has the following advantages against Carthage:
- Allows you to select which schemes should be created and which ones should be skipped. #1277, #1990, and #1616)
- Within your Xcode project, it automates the linking and cleaning of your chosen frameworks. (Replaces Carting) (#1131, #2605, #145, #2477)
- To avoid recreating the same commit of a framework for a new project, it utilizes a device-local cache automatically. # 2400 and #2716)
- Has an option to utilize a shared cache path (rather than the device-local cache) inside a team so that only one person has to build a particular commit of a dependency and everyone else in the team may reuse that cached build, significantly reducing team build times. (It takes the place of Rome.)
Accio was created as an all-in-one solution for any Carthage dependency management enhancements you may need. It’s expressly open to community-created improvements as long as they enhance elements of dependency management for Apple developers.
Furthermore, the core of Accio was built to utilize SwiftPM as much as possible since we believe it will eventually eliminate the need for a separate dependency management. Until then, being “Accio compliant” in an open source project is creating a manifest file that is identical to SwiftPM’s. This manner, Accio is attempting to bridge the gap between now and when Xcode fully supports SwiftPM for Apple platform applications (which we anticipate will be at WWDC 2020), and most Accio compatible projects may already be compatible out of the box when that time arrives.
Usage
The First Steps
This chapter explains how to get started using Accio.
Carthage is disintegrating (optional)
Here are the procedures to deintegrate Carthage if you wish to move your Carthage-driven project to Accio:
- In the project hierarchy, remove any connected dependent frameworks (this will automatically unlink from any targets)
- Remove the Carthage copy construction step from the game.
- Delete any files that begin with the word Cartfile.
- Remove the whole Carthage directory.
- Remove Carthage entries from the FRAMEWORK SEARCH PATHS in the build settings, such as $(PROJECT DIR)/Carthage/Build/iOS.
Initialization
Simply execute the init command with the name of the Xcode project file (without extension) and your App target(s) to setup Accio in a new project (separate multiple targets by a comma). Consider the following scenario:
accio init -p “XcodeProjectName” -t “AppTargetName” accio init -p “XcodeProjectName” -t “AppTargetName”
To keep your repository clean, this step will build a template Package.swift file and set some.gitignore entries. Please note that if your source code files aren’t in folders named after the targets, you’ll need to change the path parameters in the Package.swift file to the proper locations manually. Also, the given path must be a recursive directory having at least one Swift file; however, mixing with other languages, such as (Objective-)C(++), is not supported, therefore they should not be inside the specified directory. The files in there will not be built; they are just required for SwiftPM to function correctly, so you may use this wherever Swift-only code is needed.
To obtain a list of all possible choices, type accio init help.
Adding Requirements
Accio specifies dependencies using the standard SwiftPM manifest format. To add a dependency, you’ll need to perform the following:
- Add a.package item to your Package’s dependents array.
- To the dependencies section of the relevant target, add any scheme/library names you wish to build (s)
A Package.swift file with many dependencies is shown below:
import swift-tools-version:5.0 let package = Package(name: “XcodeProjectName”, products: []) let package = Package(name: “XcodeProjectName”, products: []) let package = Package(name: “XcodePro , interconnections: [.package(url: “https://github.com/Flinesoft/HandySwift.git”,.upToNextMajor(from: “2.8.0”)],.package(url: “https://github.com/Flinesoft/HandyUIKit.git”,.upToNextMajor(from: “1.9.1”)),.package(url: “https://github.com/JamitLabs [.target(name: “AppTargetName”, dependencies: [“HandySwift”, “HandyUIKit”, “MungoHealer”, “SwiftyBeaver”, “SwiftyBeaver”, “SwiftyUserDefaults”,], path: “AppTargetName”),])
Setting Up Dependencies
You may use the install or update commands to install the requirements. The only distinction is that if any dependent versions have already been resolved, install will not update them. Within the given range, update will always update to the most recent version. Consider the following scenario:
The following steps will be performed when executing this for the first time in a project:
- Check out and build all dependencies (using SwiftPM) (using Carthage)
- All build products should be cached and saved to a local cache directory for future usage in other projects.
- Put the build products in a folder called Dependencies.
- In Xcode, create a group called Dependencies, and connect the build products to the relevant targets.
- Add an Accio copy build script phase to the specified targets and change the input paths as needed.
Both install and update will ensure that all of these generated folders and build scripts are maintained up-to-date in future runs, so you won’t have to modify them manually. Actually, you shouldn’t alter their contents; nevertheless, rearranging them is acceptable.
Please note that if you have an open project in Xcode, you should shut it before executing any of the install instructions. Otherwise, when Accio rewrites the project file, unforeseen issues may arise.
You may also provide a path to a shared cache to transfer the build products to instead of the local cache for both install procedures. Consider the following scenario:
accio install -c ‘/Volumes/GoogleDrive/Team Share/AccioSharedCache/Volumes/GoogleDrive/Team Share/AccioSharedCache/Volumes/GoogleDrive/Team Share/AccioShared
Because each commit of a dependent will be created just once by one person in the team, specifying this may significantly reduce your team’s overall dependencies building time.
Please note that in the near future, a global cache will be introduced as an opt-in option for those that trust our CI setup in terms of security. Details will be provided later.
To obtain a list of all possible choices, type accio install help or accio update help.
Accio’s default behavior may be modified.
By putting the following into the Accio config file, you may set Accio to always utilize a shared cache location without having to provide it as an option:
set-shared-cache /Volumes/GoogleDrive/TeamShare/AccioCache accio accio accio accio accio accio accio accio accio accio
The config file is stored to /Users/Library/Application Support/Accio/config.json by default. To reset all configuration settings, just remove it.
Getting rid of a local cache
Because Accio automatically caches any build products locally on your computer, the cache may quickly fill up. As a result, you may wish to execute the clear-cache command to remove the local cache from time to time:
This will clear the cache of all build products and inform you how much space was freed up. Please keep in mind that there is presently no mechanism to erase a shared cache to prevent a single team member from accidentally deleting anything. If your shared area becomes too crowded, please do this manually.
Note that there is a clean command that should not be confused with this. The clean command will only delete files from the.accio build path, which will result in all dependencies being checked out again on the next install. It also removes any temporary files left behind from failed or canceled Accio operations.
Support for Accio has been added.
The majority of SwiftPM-compatible libraries should immediately function with Accio. There’s also a Demo project with integration tests on the CI to verify that Accio is supported by the vast majority of Swift frameworks on GitHub with at least 1,000 stars. Libraries that work with Carthage may easily be made to work with Accio by creating a Package.swift file that looks like this:
import swift-tools-version:4.2 Package let package = Package(name: “LibraryName”, “LibraryName”, “LibraryName”, “LibraryName”, “Library [.iOS(“8.0”),.macOS(“10.10”),.tvOS(“9.0”),.watchOS(“2.0”)] [.library(name: “LibraryName”), targets: [“LibraryName”)]], products: [.library(name: “LibraryName”)] [.target(name: “LibraryName”, path: “LibraryName”)]), targets:
If the library only supports Swift 5 or above, the commented platforms parameter line may be uncommented (it was added to Swift Package Manager via proposal SE-0236). However, for Swift 4.2 compatibility, it is presently advised to leave the line commented out — Accio will take care of manually specifying the target versions if the line is commented out.
If the library contains subdependencies, connect the projects in the target’s dependencies array to the library names in the target’s dependencies array. Consider the following scenario:
import swift-tools-version:4.2 PackageDescription let package = Package(name: “LibraryName”, “LibraryName”, “LibraryName”, “LibraryName”, “LibraryName [.iOS(“8.0”),.macOS(“10.10”),.tvOS(“9.0”),.watchOS(“2.0”)] [.library(name: “LibraryName”), targets: [“LibraryName”)]], products: [.library(name: “LibraryName”)] , dependencies: [.package(url: “https://github.com/Alamofire/Alamofire.git”,.upToNextMajor(from: “4.1.0”)],.package(url: “https://github.com/antitypical/Result.git”,.upToNextMajor(from: “4.0.0”)), ] targets: [.target( name: “LibraryName”, dependencies: [“
For more information on how to set it, such as the additional options for specifying the version range of dependencies, see the official Package manifest documentation.
Please create a GitHub issue if you run into any problems with a dependency that you expect to function with Accio.
Badge of Authorization
Add the following to the top of your README.md to indicate that your project supports Accio installation:
[![Accio supported](http://imagegod.b-cdn.net/wp-content/uploads/2021/10/Elegant-transition-library-for-iOS-tvOS.svg.svg+xml;charset=utf-8)] [![Accio supported](http://imagegod.b-cdn.net/wp-content/uploads/2021/10/Elegant-transition-library-for-iOS- (https://github.com/JamitLabs/Accio)
Contributing
See the file CONTRIBUTING.md for further information.
License
The MIT License applies to this library. Details may be found in the LICENSE.
Dogan Duran created the logo.
GitHub
https://github.com/JamitLabs/Accio
The “swift package manager version tag” is a dependency manager driven by SwiftPM that works for iOS/tvOS/watchOS/macOS projects.
Related Tags
- swift local package dependency
- cocoapods and swift package manager
- dependency management in swift
- swift package manager limitations
- swift package manager multiple targets