Skip to content

Instantly share code, notes, and snippets.

@tobitech
Created April 23, 2024 15:02
Show Gist options
  • Save tobitech/e3a57a6296ffc93a6c91afe1f6802faf to your computer and use it in GitHub Desktop.
Save tobitech/e3a57a6296ffc93a6c91afe1f6802faf to your computer and use it in GitHub Desktop.
Ratio App Modularisation Structure.
// swift-tools-version: 5.7
import PackageDescription
let package = Package(
name: "ratioapp",
platforms: [
.iOS("16.6")
],
products: [
.library(name: "AddTransactionFeature", targets: ["AddTransactionFeature"]),
.library(name: "AppCore", targets: ["AppCore"]),
.library(name: "AuthenticationClient", targets: ["AuthenticationClient"]),
.library(name: "AuthenticationClientLive",targets: ["AuthenticationClientLive"]),
.library(name: "BackgroundTasksClient",targets: ["BackgroundTasksClient"]),
.library(name: "BadgesFeature", targets: ["BadgesFeature"]),
.library(name: "BillsFeature", targets: ["BillsFeature"]),
.library(name: "ChooseCategoryFeature", targets: ["ChooseCategoryFeature"]),
.library(name: "ChooseCurrencyFeature", targets: ["ChooseCurrencyFeature"]),
.library(name: "DataStoreClient", targets: ["DataStoreClient"]),
.library(name: "DataStoreClientLive", targets: ["DataStoreClientLive"]),
.library(name: "DateHelpers", targets: ["DateHelpers"]),
.library(name: "FileManagerClient", targets: ["FileManagerClient"]),
.library(name: "InsightsFeature", targets: ["InsightsFeature"]),
.library(name: "MainFeature", targets: ["MainFeature"]),
.library(name: "MerchantFeature", targets: ["MerchantFeature"]),
.library(name: "PaywallFeature", targets: ["PaywallFeature"]),
.library(name: "ProfileFeature", targets: ["ProfileFeature"]),
.library(name: "ObjectStorageClient", targets: ["ObjectStorageClient"]),
.library(name: "ObjectStorageClientLive", targets: ["ObjectStorageClientLive"]),
.library(name: "OnboardingFeature", targets: ["OnboardingFeature"]),
.library(name: "OverviewFeature", targets: ["OverviewFeature"]),
.library(name: "RatioUI", targets: ["RatioUI"]),
.library(name: "SearchFeature", targets: ["SearchFeature"]),
.library(name: "SettingsFeature", targets: ["SettingsFeature"]),
.library(name: "SharedModels", targets: ["SharedModels"]),
.library(name: "StoreKitClient", targets: ["StoreKitClient"]),
.library(name: "StreaksFeature", targets: ["StreaksFeature"]),
.library(name: "SwiftUIHelpers", targets: ["SwiftUIHelpers"]),
.library(name: "TCAHelpers", targets: ["TCAHelpers"]),
.library(name: "TransactionDetailsFeature", targets: ["TransactionDetailsFeature"]),
.library(name: "TransactionsListFeature", targets: ["TransactionsListFeature"]),
.library(name: "UIApplicationClient", targets: ["UIApplicationClient"]),
.library(name: "UserDefaultsClient", targets: ["UserDefaultsClient"]),
.library(name: "UserNotificationsClient", targets: ["UserNotificationsClient"]
)
],
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "1.9.3"),
.package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "1.2.1"),
.package(url: "https://github.com/realm/realm-swift.git", from: "10.47.0"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.2.2"),
.package(url: "https://github.com/apple/swift-algorithms", from: "1.1.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.1.0"),
.package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.27.1")
],
targets: [
.target(
name: "AddTransactionFeature",
dependencies: [
"AuthenticationClient",
"ChooseCategoryFeature",
"ChooseCurrencyFeature",
"DataStoreClient",
"FileManagerClient",
"MerchantFeature",
"ObjectStorageClient",
"PaywallFeature",
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
"TCAHelpers",
"UserNotificationsClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "AddTransactionFeatureTests",
dependencies: ["AddTransactionFeature"]
),
.target(
name: "AppCore",
dependencies: [
"BackgroundTasksClient",
"MainFeature",
"OnboardingFeature",
"PaywallFeature",
"SharedModels",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
]
),
.testTarget(
name: "AppCoreTests",
dependencies: ["AppCore"]
),
.target(
name: "AuthenticationClient",
dependencies: [
"SharedModels",
.product(name: "Dependencies", package: "swift-dependencies"),
]
),
.target(
name: "AuthenticationClientLive",
dependencies: [
"AuthenticationClient",
.product(name: "RealmSwift", package: "realm-swift")
]
),
.target(
name: "BackgroundTasksClient",
dependencies: [
.product(name: "Dependencies", package: "swift-dependencies"),
]
),
.target(
name: "BadgesFeature",
dependencies: [
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "BadgesFeatureTests",
dependencies: ["BadgesFeature"]
),
.target(
name: "BillsFeature",
dependencies: [
"AddTransactionFeature",
"BadgesFeature",
"DataStoreClient",
"DateHelpers",
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
"TransactionDetailsFeature",
.product(name: "Algorithms", package: "swift-algorithms"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "BillsFeatureTests",
dependencies: ["BillsFeature"]
),
.target(
name: "ChooseCategoryFeature",
dependencies: [
"AuthenticationClient",
"DataStoreClient",
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
"TCAHelpers",
"UserDefaultsClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "ChooseCategoryFeatureTests",
dependencies: ["ChooseCategoryFeature"]
),
.target(
name: "ChooseCurrencyFeature",
dependencies: [
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
]
),
.testTarget(
name: "ChooseCurrencyFeatureTests",
dependencies: ["ChooseCurrencyFeature"]
),
.target(
name: "DataStoreClient",
dependencies: [
"DateHelpers",
"SharedModels",
.product(name: "Dependencies", package: "swift-dependencies"),
],
resources: [
.process("mocks")
]
),
.target(
name: "DataStoreClientLive",
dependencies: [
"DataStoreClient",
.product(name: "RealmSwift", package: "realm-swift")
]
),
.target(
name: "DateHelpers",
dependencies: [
.product(name: "Dependencies", package: "swift-dependencies")
]
),
.target(
name: "FileManagerClient",
dependencies: [
"SharedModels",
.product(name: "Dependencies", package: "swift-dependencies"),
]
),
.target(
name: "InsightsFeature",
dependencies: [
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
"DataStoreClient",
"TCAHelpers",
"TransactionDetailsFeature",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "InsightsFeatureTests",
dependencies: ["InsightsFeature"]
),
.target(
name: "MainFeature",
dependencies: [
"BillsFeature",
"InsightsFeature",
"OverviewFeature",
"ProfileFeature",
"SharedModels",
"UserDefaultsClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "MainFeatureTests",
dependencies: ["MainFeature"]
),
.target(
name: "MerchantFeature",
dependencies: [
"AuthenticationClient",
"DataStoreClient",
"RatioUI",
"SharedModels",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "MerchantFeatureTests",
dependencies: ["MerchantFeature"]
),
.target(
name: "ObjectStorageClient",
dependencies: [
"SharedModels",
.product(name: "Dependencies", package: "swift-dependencies"),
]
),
.target(
name: "ObjectStorageClientLive",
dependencies: [
"ObjectStorageClient",
.product(name: "Amplify", package: "amplify-swift"),
.product(name: "AWSCognitoAuthPlugin", package: "amplify-swift"),
.product(name: "AWSS3StoragePlugin", package: "amplify-swift")
]
),
.target(
name: "OnboardingFeature",
dependencies: [
"AuthenticationClient",
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
]
),
.testTarget(
name: "OnboardingFeatureTests",
dependencies: ["OnboardingFeature"]
),
.target(
name: "OverviewFeature",
dependencies: [
"AddTransactionFeature",
"BadgesFeature",
"BillsFeature",
"DataStoreClient",
"ProfileFeature",
"RatioUI",
"SearchFeature",
"SharedModels",
"StreaksFeature",
"SwiftUIHelpers",
"TransactionDetailsFeature",
"TransactionsListFeature",
"UIApplicationClient",
"UserDefaultsClient",
"UserNotificationsClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "OverviewFeatureTests",
dependencies: ["OverviewFeature"]
),
.target(
name: "PaywallFeature",
dependencies: [
"DataStoreClient",
"RatioUI",
"SharedModels",
"StoreKitClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "PaywallFeatureTests",
dependencies: ["PaywallFeature"]
),
.target(
name: "ProfileFeature",
dependencies: [
"AuthenticationClient",
"BadgesFeature",
"DataStoreClient",
"ObjectStorageClient",
"RatioUI",
"SettingsFeature",
"SharedModels",
"UIApplicationClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "ProfileFeatureTests",
dependencies: ["ProfileFeature"]
),
.target(
name: "RatioUI",
dependencies: [
"SharedModels",
"SwiftUIHelpers"
]
),
.target(
name: "SearchFeature",
dependencies: [
"DataStoreClient",
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
"TransactionDetailsFeature",
"TransactionsListFeature",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
]
),
.testTarget(
name: "SearchFeatureTests",
dependencies: ["SearchFeature"]
),
.target(
name: "SettingsFeature",
dependencies: [
"AuthenticationClient",
"ChooseCurrencyFeature",
"ChooseCategoryFeature",
"MerchantFeature",
"PaywallFeature",
"RatioUI",
"SharedModels",
"StoreKitClient",
"SwiftUIHelpers",
"TCAHelpers",
"UIApplicationClient",
"UserDefaultsClient",
"UserNotificationsClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "SwiftUINavigation", package: "swiftui-navigation")
],
resources: [
.process("resources")
]
),
.testTarget(
name: "SettingsFeatureTests",
dependencies: ["SettingsFeature"]
),
.target(
name: "SharedModels",
dependencies: [
"DateHelpers",
.product(name: "Dependencies", package: "swift-dependencies"),
]
),
.target(
name: "StoreKitClient",
dependencies: [
"DataStoreClient",
"SharedModels",
"UserDefaultsClient",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
],
resources: [
.process("resources")
]
),
.target(
name: "StreaksFeature",
dependencies: [
"DataStoreClient",
"SharedModels",
"RatioUI",
"SwiftUIHelpers",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture")
]
),
.testTarget(
name: "StreaksFeatureTests",
dependencies: ["StreaksFeature"]
),
.target(
name: "SwiftUIHelpers",
dependencies: []
),
.target(
name: "TCAHelpers",
dependencies: [
.product(name: "ComposableArchitecture", package: "swift-composable-architecture")
]
),
.target(
name: "TransactionDetailsFeature",
dependencies: [
"AddTransactionFeature",
"DataStoreClient",
"FileManagerClient",
"ObjectStorageClient",
"SharedModels",
"RatioUI",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture")
]
),
.testTarget(
name: "TransactionDetailsFeatureTests",
dependencies: ["TransactionDetailsFeature"]
),
.target(
name: "TransactionsListFeature",
dependencies: [
"AddTransactionFeature",
"DataStoreClient",
"SharedModels",
"RatioUI",
"TransactionDetailsFeature",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture")
]
),
.testTarget(
name: "TransactionsListFeatureTests",
dependencies: ["TransactionsListFeature"]
),
.target(
name: "UIApplicationClient",
dependencies: [
.product(name: "Dependencies", package: "swift-dependencies"),
]
),
.target(
name: "UserDefaultsClient",
dependencies: [
"SharedModels",
.product(name: "Dependencies", package: "swift-dependencies"),
]
),
.target(
name: "UserNotificationsClient",
dependencies: [
"SharedModels",
.product(name: "Dependencies", package: "swift-dependencies"),
]
)
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment