[Improvement] Naming of libraries and package (#22)

This PR contains the work done to fix the naming of the libraries and the package, along with tweaks to the folder structure.

Reviewed-on: #22
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit is contained in:
Javier Cicchelli 2023-08-13 21:53:47 +00:00 committed by Javier Cicchelli
parent 060d8a84a9
commit e6e82b3b40
54 changed files with 65 additions and 53 deletions

View File

@ -14,56 +14,56 @@ import PackageDescription
// MARK: - Variables
private var targetsLibrary: [String] = [
.Target.communications,
.Target.communication,
.Target.coordination,
.Target.core,
.Target.dependencies,
.Target.foundation,
.Target.dependency,
]
private var targetsPackage: [Target] = [
.target(
name: .Target.communications,
dependencies: []
name: .Target.communication,
path: "Libraries/Communication"
),
.target(
name: .Target.coordination,
dependencies: []
path: "Libraries/Coordination"
),
.target(
name: .Target.core,
dependencies: []
name: .Target.foundation,
path: "Libraries/Foundation"
),
.target(
name: .Target.dependencies,
dependencies: []
name: .Target.dependency,
path: "Libraries/Dependency"
),
.testTarget(
name: "CommunicationsTests",
name: .Target.communication.tests,
dependencies: [
.init(stringLiteral: .Target.communications)
.init(stringLiteral: .Target.communication)
],
path: "Tests/Communications"
path: "Tests/Communication"
),
.testTarget(
name: "CoordinationTests",
name: .Target.coordination.tests,
dependencies: [
.init(stringLiteral: .Target.coordination)
],
path: "Tests/Coordination"
),
.testTarget(
name: "CoreTests",
name: .Target.foundation.tests,
dependencies: [
.init(stringLiteral: .Target.core)
.init(stringLiteral: .Target.foundation)
],
path: "Tests/Core"
path: "Tests/Foundation"
),
.testTarget(
name: "DependenciesTests",
name: .Target.dependency.tests,
dependencies: [
.init(stringLiteral: .Target.dependencies)
.init(stringLiteral: .Target.dependency)
],
path: "Tests/Dependencies"
path: "Tests/Dependency"
),
]
@ -72,10 +72,10 @@ targetsLibrary.append(.Target.persistence)
targetsPackage.append(contentsOf: [
.target(
name: .Target.persistence,
dependencies: []
path: "Libraries/Persistence"
),
.testTarget(
name: "PersistenceTests",
name: .Target.persistence.tests,
dependencies: [
.init(stringLiteral: .Target.persistence)
],
@ -100,7 +100,7 @@ let package = Package(
],
products: [
.library(
name: .Package.name,
name: .Library.name,
targets: targetsLibrary
),
],
@ -112,14 +112,26 @@ let package = Package(
private extension String {
enum Package {
static let name = "swift-libs"
}
enum Library {
static let name = "SwiftLibs"
}
enum Target {
static let communications = "Communications"
static let coordination = "Coordination"
static let core = "Core"
static let dependencies = "Dependencies"
static let persistence = "Persistence"
static let communication = "SwiftLibsCommunication"
static let coordination = "SwiftLibsCoordination"
static let foundation = "SwiftLibsFoundation"
static let dependency = "SwiftLibsDependency"
static let persistence = "SwiftLibsPersistence"
}
}
// MARK: - String+Computed
private extension String {
var tests: String {
self + "Tests"
}
}

View File

@ -14,11 +14,11 @@ This package contains the core building blocks that we, [Röck+Cöde](https://ro
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:
* `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` (*available for Apple platforms only*): protocols, extensions and a ready-to-use fetcher class to simplify the building of the [CoreData](https://developer.apple.com/documentation/coredata) persistence layer;
* `SwiftLibsCommunication`: protocols, enumerations and a ready-to-use mock url class to build remote API services;
* `SwiftLibsCoordination`: protocols to implement the [Coordinator pattern](https://khanlou.com/2015/01/the-coordinator/) and some ready-to-use platform-specific concrete routers;
* `SwiftLibsDependency`: 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);
* `SwiftLibsFoundation`: 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);
* `SwiftLibsPersistence` (*available for Apple platforms only*): 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
@ -37,7 +37,7 @@ In the intended `Package.swift` file, it is required to add the following depend
```swift
dependencies: [
// ...
.package(url: "https://github.com/rock-n-code/swift-libs.git", from: "0.1.7")
.package(url: "https://github.com/rock-n-code/swift-libs.git", from: "0.2.0")
// ...
],
```
@ -66,7 +66,7 @@ In an opened Xcode project, it is required to follow these steps to install the
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.7* text are recommended);
7. define the dependency rule (the *Up to Next Major Version* option and the *0.2.0* 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!

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
import Communications
import Foundation
import SwiftLibsCommunication
import XCTest
#if canImport(FoundationNetworking)

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
import Communications
import Foundation
import SwiftLibsCommunication
struct TestEndpoint: Endpoint {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Dependencies
import SwiftLibsDependency
import XCTest
final class DependencyTests: XCTestCase {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Dependencies
import SwiftLibsDependency
import XCTest
final class DependencyServiceTests: XCTestCase {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Dependencies
import SwiftLibsDependency
// MARK: - Protocols

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Core
import SwiftLibsFoundation
import XCTest
final class Bool_InitTests: XCTestCase {

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
import Core
import Foundation
import SwiftLibsFoundation
import XCTest
final class Bundle_LocalisationBundleTests: XCTestCase {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Core
import SwiftLibsFoundation
import XCTest
final class Collection_EmptyTests: XCTestCase {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Core
import SwiftLibsFoundation
import XCTest
final class Optional_NilTests: XCTestCase {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Core
import SwiftLibsFoundation
import XCTest
final class String_EmptyTests: XCTestCase {

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
import Core
import Foundation
import SwiftLibsFoundation
import XCTest
final class String_LocalisationTests: XCTestCase {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Core
import SwiftLibsFoundation
import XCTest
final class TimeZone_ZoneTests: XCTestCase {

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
import Core
import Foundation
import SwiftLibsFoundation
import XCTest
final class LossyCodableList_DecodableTests: XCTestCase {

View File

@ -13,7 +13,7 @@
import Foundation
import XCTest
@testable import Core
@testable import SwiftLibsFoundation
final class LossyCodableList_EncodableTests: XCTestCase {

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
import Core
import SwiftLibsFoundation
struct TestCodableList: Codable {
@LossyCodableList var items: [TestCodable]

View File

@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
import Combine
import Persistence
import SwiftLibsPersistence
import XCTest
final class FetcherTests: XCTestCase {

View File

@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
import Foundation
import Persistence
import SwiftLibsPersistence
import XCTest
final class URL_DevicesTests: XCTestCase {

View File

@ -12,7 +12,7 @@
import CoreData
import Foundation
import Persistence
import SwiftLibsPersistence
struct TestPersistenceService {