This package contains several libraries which can be imported, and these libraries are grouped by a certain concern, feature or purpose.
To provide further details about the libraries included in this package:
SwiftLibsCommunication: protocols, enumerations and a ready-to-use mock url class to build remote API services;
SwiftLibsCoordination: protocols to implement the Coordinator pattern and some ready-to-use platform-specific concrete routers;
SwiftLibsDependency: a ready-to-use, simple Dependency Injection mechanism that levers heavily on the dynamic property wrappers provided by the Swift programming language;
SwiftLibsFoundation: extensions we usually add to the base layer functionality and primitive types provided by the Swift standard library;
SwiftLibsPersistence(available for Apple platforms only): protocols, extensions and a ready-to-use fetcher class to simplify the building of the CoreData persistence layer;
It is possible to add this package to other libraries and applications by adding it as a dependency in a
Package.swift file or in a Xcode project, through the Package dependencies interface.
This package has minimum platform requirements that are important to take into account:
- iOS 15.0 or higher;
- macOS 12.0 or higher;
- tvOS 15.0 or higher;
- watchOS 8.0 or higher.
In the intended
Package.swift file, it is required to add the following dependency:
dependencies: [ // ... .package(url: "https://github.com/rock-n-code/swift-libs.git", from: "0.2.0") // ... ],
Then it is required to add the package to your target, like this:
targets: [ .target( // ... dependencies: [ .product(name: "SwiftLibs", package: "swift-libs") ], // ... ), ]
In an opened Xcode project, it is required to follow these steps to install the package:
- click on the Xcode project file in the sidebar to display Project and Targets;
- select the project under the Project section to show the Info, Build Settings and Package Dependencies options in the center menu just right on top;
- select the Package Dependencies option to show the defined dependencies of the project;
- press on the + (plus) button to add dependencies to the project;
- enter the URL
https://github.com/rock-n-code/swift-libs.gitinto the Search or Enter Package URL located in the upper right corner;
- select the retrieved option;
- define the dependency rule (the Up to Next Major Version option and the 0.2.0 text are recommended);
- select the target to which the dependency will be applied (if required);
- wait for the package to be resolved and included in the project;
- now you should be ready to start using this package!
This library is fully supported on Apple platforms: iOS, macOS, tvOS, and watchOS. In addition, basic support for Linux platform has been added as well, but it is rather limited for the time being. It is just a matter of time, though, as the Foundation framework is moving towards cross-platform support by moving away from its dependency on legacy Objective-C components.