From d2c73e7648a639fb86c597f800df26a6f7675fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Do=CC=88nicke?= Date: Fri, 22 Oct 2021 22:43:24 +0200 Subject: [PATCH] Add presentation layer as package --- CleanApp/CleanApp.xcodeproj/project.pbxproj | 54 +++++++++++-------- CleanApp/Modules/PresentationLayer/.gitignore | 7 +++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../Modules/PresentationLayer/Package.swift | 34 ++++++++++++ CleanApp/Modules/PresentationLayer/README.md | 3 ++ .../Sources/Assets.xcassets}/Contents.json | 0 .../Sources}/ContentView.swift | 8 +-- .../Preview Assets.xcassets/Contents.json | 6 +++ .../Tests/PresentationTests.swift | 10 ++++ CleanApp/iOS/CleanApp.swift | 1 + 10 files changed, 106 insertions(+), 25 deletions(-) create mode 100644 CleanApp/Modules/PresentationLayer/.gitignore create mode 100644 CleanApp/Modules/PresentationLayer/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 CleanApp/Modules/PresentationLayer/Package.swift create mode 100644 CleanApp/Modules/PresentationLayer/README.md rename CleanApp/{iOS/Preview Content/Preview Assets.xcassets => Modules/PresentationLayer/Sources/Assets.xcassets}/Contents.json (100%) rename CleanApp/{iOS => Modules/PresentationLayer/Sources}/ContentView.swift (74%) create mode 100644 CleanApp/Modules/PresentationLayer/Sources/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 CleanApp/Modules/PresentationLayer/Tests/PresentationTests.swift diff --git a/CleanApp/CleanApp.xcodeproj/project.pbxproj b/CleanApp/CleanApp.xcodeproj/project.pbxproj index 50aef30..b54d6d4 100644 --- a/CleanApp/CleanApp.xcodeproj/project.pbxproj +++ b/CleanApp/CleanApp.xcodeproj/project.pbxproj @@ -7,10 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 4931823827235951005EE252 /* PresentationLayer in Frameworks */ = {isa = PBXBuildFile; productRef = 4931823727235951005EE252 /* PresentationLayer */; }; 493CDDD62723258300499858 /* CleanApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493CDDD52723258300499858 /* CleanApp.swift */; }; - 493CDDD82723258300499858 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493CDDD72723258300499858 /* ContentView.swift */; }; - 493CDDDA2723258400499858 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 493CDDD92723258400499858 /* Assets.xcassets */; }; - 493CDDDD2723258400499858 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 493CDDDC2723258400499858 /* Preview Assets.xcassets */; }; 493CDDE72723258400499858 /* iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493CDDE62723258400499858 /* iOSTests.swift */; }; 493CDDF12723258400499858 /* iOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493CDDF02723258400499858 /* iOSUITests.swift */; }; 493CDDF32723258400499858 /* iOSUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493CDDF22723258400499858 /* iOSUITestsLaunchTests.swift */; }; @@ -34,11 +32,10 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 49204DE3272346EF00891C5E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 4931822F27234CAD005EE252 /* PresentationLayer */ = {isa = PBXFileReference; lastKnownFileType = folder; name = PresentationLayer; path = Modules/PresentationLayer; sourceTree = ""; }; 493CDDD22723258300499858 /* CleanApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CleanApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 493CDDD52723258300499858 /* CleanApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CleanApp.swift; sourceTree = ""; }; - 493CDDD72723258300499858 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; - 493CDDD92723258400499858 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 493CDDDC2723258400499858 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 493CDDE22723258400499858 /* iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 493CDDE62723258400499858 /* iOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSTests.swift; sourceTree = ""; }; 493CDDEC2723258400499858 /* iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -51,6 +48,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4931823827235951005EE252 /* PresentationLayer in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -71,13 +69,30 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 4926B7CE272338AE00DEC77E /* Packages */ = { + isa = PBXGroup; + children = ( + 4931822F27234CAD005EE252 /* PresentationLayer */, + ); + name = Packages; + sourceTree = ""; + }; + 4931822A27234BE5005EE252 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; 493CDDC92723258300499858 = { isa = PBXGroup; children = ( + 4926B7CE272338AE00DEC77E /* Packages */, 493CDDD42723258300499858 /* iOS */, 493CDDE52723258400499858 /* iOSTests */, 493CDDEF2723258400499858 /* iOSUITests */, 493CDDD32723258300499858 /* Products */, + 4931822A27234BE5005EE252 /* Frameworks */, ); sourceTree = ""; }; @@ -95,21 +110,11 @@ isa = PBXGroup; children = ( 493CDDD52723258300499858 /* CleanApp.swift */, - 493CDDD72723258300499858 /* ContentView.swift */, - 493CDDD92723258400499858 /* Assets.xcassets */, - 493CDDDB2723258400499858 /* Preview Content */, + 49204DE3272346EF00891C5E /* Assets.xcassets */, ); path = iOS; sourceTree = ""; }; - 493CDDDB2723258400499858 /* Preview Content */ = { - isa = PBXGroup; - children = ( - 493CDDDC2723258400499858 /* Preview Assets.xcassets */, - ); - path = "Preview Content"; - sourceTree = ""; - }; 493CDDE52723258400499858 /* iOSTests */ = { isa = PBXGroup; children = ( @@ -143,6 +148,9 @@ dependencies = ( ); name = iOS; + packageProductDependencies = ( + 4931823727235951005EE252 /* PresentationLayer */, + ); productName = CleanApp; productReference = 493CDDD22723258300499858 /* CleanApp.app */; productType = "com.apple.product-type.application"; @@ -231,8 +239,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 493CDDDD2723258400499858 /* Preview Assets.xcassets in Resources */, - 493CDDDA2723258400499858 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -257,7 +263,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 493CDDD82723258300499858 /* ContentView.swift in Sources */, 493CDDD62723258300499858 /* CleanApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -418,7 +423,6 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -447,7 +451,6 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -601,6 +604,13 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 4931823727235951005EE252 /* PresentationLayer */ = { + isa = XCSwiftPackageProductDependency; + productName = PresentationLayer; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 493CDDCA2723258300499858 /* Project object */; } diff --git a/CleanApp/Modules/PresentationLayer/.gitignore b/CleanApp/Modules/PresentationLayer/.gitignore new file mode 100644 index 0000000..bb460e7 --- /dev/null +++ b/CleanApp/Modules/PresentationLayer/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata diff --git a/CleanApp/Modules/PresentationLayer/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/CleanApp/Modules/PresentationLayer/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/CleanApp/Modules/PresentationLayer/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/CleanApp/Modules/PresentationLayer/Package.swift b/CleanApp/Modules/PresentationLayer/Package.swift new file mode 100644 index 0000000..93b10f4 --- /dev/null +++ b/CleanApp/Modules/PresentationLayer/Package.swift @@ -0,0 +1,34 @@ +// swift-tools-version:5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "PresentationLayer", + platforms: [ + .macOS(.v11), + .iOS(.v15) + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "PresentationLayer", + targets: ["PresentationLayer"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "PresentationLayer", + dependencies: [], + path: "Sources"), + .testTarget( + name: "PresentationLayerTests", + dependencies: ["PresentationLayer"], + path: "Tests"), + ] +) diff --git a/CleanApp/Modules/PresentationLayer/README.md b/CleanApp/Modules/PresentationLayer/README.md new file mode 100644 index 0000000..b73bd3a --- /dev/null +++ b/CleanApp/Modules/PresentationLayer/README.md @@ -0,0 +1,3 @@ +# PresentationLayer + +Presentation layer of CleanApp. diff --git a/CleanApp/iOS/Preview Content/Preview Assets.xcassets/Contents.json b/CleanApp/Modules/PresentationLayer/Sources/Assets.xcassets/Contents.json similarity index 100% rename from CleanApp/iOS/Preview Content/Preview Assets.xcassets/Contents.json rename to CleanApp/Modules/PresentationLayer/Sources/Assets.xcassets/Contents.json diff --git a/CleanApp/iOS/ContentView.swift b/CleanApp/Modules/PresentationLayer/Sources/ContentView.swift similarity index 74% rename from CleanApp/iOS/ContentView.swift rename to CleanApp/Modules/PresentationLayer/Sources/ContentView.swift index 5da2842..1617308 100644 --- a/CleanApp/iOS/ContentView.swift +++ b/CleanApp/Modules/PresentationLayer/Sources/ContentView.swift @@ -1,17 +1,19 @@ // // ContentView.swift -// iOS +// // // Created by Miguel Dönicke on 22.10.21. // import SwiftUI -struct ContentView: View { - var body: some View { +public struct ContentView: View { + public var body: some View { Text("Hello, world!") .padding() } + + public init() {} } struct ContentView_Previews: PreviewProvider { diff --git a/CleanApp/Modules/PresentationLayer/Sources/Preview Content/Preview Assets.xcassets/Contents.json b/CleanApp/Modules/PresentationLayer/Sources/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CleanApp/Modules/PresentationLayer/Sources/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CleanApp/Modules/PresentationLayer/Tests/PresentationTests.swift b/CleanApp/Modules/PresentationLayer/Tests/PresentationTests.swift new file mode 100644 index 0000000..89f45e5 --- /dev/null +++ b/CleanApp/Modules/PresentationLayer/Tests/PresentationTests.swift @@ -0,0 +1,10 @@ +import XCTest +@testable import Presentation + +final class PresentationTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + } +} diff --git a/CleanApp/iOS/CleanApp.swift b/CleanApp/iOS/CleanApp.swift index f5d0649..62d86eb 100644 --- a/CleanApp/iOS/CleanApp.swift +++ b/CleanApp/iOS/CleanApp.swift @@ -5,6 +5,7 @@ // Created by Miguel Dönicke on 22.10.21. // +import PresentationLayer import SwiftUI @main