swift-libs/README.md
Javier Cicchelli 4a1fab2f8a [Bugfix] Mobile platform builds (#11)
This PR contains the work done to address the issue #10, that was raised based on the build logs from publishing the package in the Swift Package Index.

To provide further details about the work done:
- [x] fixed the `Router` protocol that was causing a compilation issue on *watchOS* platforms;
- [x] downgraded the swift tools version in the `Package` file to v5.5;
- [x] bumped the minimum platform version in the `Package` file to restrict support to the last 2 major releases;
- [x] written the *Installation* section in the `README` file;
- [x] updated the project logo assets, including light and dark versions;
- [x] updated the project logo in the `README` file and added support for both light and dark modes.

Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Reviewed-on: #11
2023-04-25 13:38:30 +00:00

79 lines
4.2 KiB
Markdown

<center>
<picture>
<source srcset="imgs/swiftlibs-logo-dark.svg" media="(prefers-color-scheme: dark)">
<img src="imgs/swiftlibs-logo-light.svg" alt="Shows the hand-drawn SwiftLibs package logo centered in the page.">
</picture>
</center>
# SwiftLibs
This package contains the core building blocks that we, [Röck+Cöde](https://rock-n-code.com), usually use to build any kind of application written in the [Swift programming language](https://www.swift.org/documentation/).
## Libraries
This package contains several libraries which a developer can also use in their own codebase, and these libraries are grouped by a certain concern or purpose.
To provide further details about the libraries included in this package:
* `Communications`: protocols, enumerations and a ready-to-use mock url class to build remote API services;
* `Coordination`: protocols to implement the [Coordinator pattern](https://khanlou.com/2015/01/the-coordinator/) and some ready-to-use platform-specific concrete routers;
* `Core`: extensions we usually add to the base layer functionality and primitive types provided by the [Swift standard library](https://https://www.swift.org/documentation/#standard-library);
* `Dependencies`: a ready-to-use, simple [Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection) mechanism that levers heavily on the [dynamic property wrappers](https://www.hackingwithswift.com/plus/intermediate-swiftui/creating-a-custom-property-wrapper-using-dynamicproperty) provided by the [Swift programming language](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/properties/#Projecting-a-Value-From-a-Property-Wrapper);
* `Persistence`: protocols, extensions and a ready-to-use fetcher class to simplify the building of the [CoreData](https://developer.apple.com/documentation/coredata) persistence layer;
## Installation
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*.
### Package file
In the intended `Package.swift` file, it is required to add the following dependency:
```swift
dependencies: [
// ...
.package(url: "https://github.com/rock-n-code/swift-libs.git", from: "0.1.3")
// ...
],
```
Then it is required to add the package to your target, like this:
```swift
targets: [
.target(
// ...
dependencies: [
.product(name: "SwiftLibs", package: "swift-libs")
],
// ...
),
]
```
### Xcode
In an opened Xcode project, it is required to follow these steps to install the package:
1. click on the Xcode project file in the sidebar to display *Project* and *Targets*;
2. 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;
3. select the *Package Dependencies* option to show the defined dependencies of the project;
4. press on the *+* (plus) button to add dependencies to the project;
5. enter the URL `https://github.com/rock-n-code/swift-libs.git` into the *Search or Enter Package URL* located in the upper right corner;
6. select the retrieved option;
7. define the dependency rule (the *Up to Next Major Version* option and the *0.1.3* text are recommended);
8. select the target to which the dependency will be applied (if required);
9. wait for the package to be resolved and included in the project;
10. now you should be ready to start using this package!
### Other considerations
This library is fully supported on Apple platforms only for the time being: *iOS*, *macOS*, *tvOS*, and *watchOS*. Support for other platforms such as *Linux* or *Windows* might be added in the future, depending on the type of changes those platforms require but this needs to be researched first.
⚠️ Please notice that this library only supports the [Swift Package Manager](https://www.swift.org/package-manager/), and that support for other dependency managers such as *Cocoapods* and *Carthage* has not been prioritised.