diff --git a/Plugins/DependencyPlugin/ProjectDescriptionHelpers/Module/Core.swift b/Plugins/DependencyPlugin/ProjectDescriptionHelpers/Module/Core.swift index cc3f95d..8e3b0dd 100644 --- a/Plugins/DependencyPlugin/ProjectDescriptionHelpers/Module/Core.swift +++ b/Plugins/DependencyPlugin/ProjectDescriptionHelpers/Module/Core.swift @@ -14,4 +14,5 @@ public enum Core: String, Modulable { case UserNotificationClient case DatabaseClient case UserDefaultsClient + case FeedbackGeneratorClient } diff --git a/Projects/Core/APIClient/Project.swift b/Projects/Core/APIClient/Project.swift index 27355ef..cb38663 100644 --- a/Projects/Core/APIClient/Project.swift +++ b/Projects/Core/APIClient/Project.swift @@ -1,3 +1,10 @@ +// +// Project.swift +// APIClientManifests +// +// Created by devMinseok on 8/16/24. +// + import ProjectDescription import ProjectDescriptionHelpers diff --git a/Projects/Core/Core/Project.swift b/Projects/Core/Core/Project.swift index 6317c5a..51b50b2 100644 --- a/Projects/Core/Core/Project.swift +++ b/Projects/Core/Core/Project.swift @@ -1,3 +1,10 @@ +// +// Project.swift +// CoreManifests +// +// Created by devMinseok on 8/16/24. +// + import ProjectDescription import ProjectDescriptionHelpers diff --git a/Projects/Core/DatabaseClient/Project.swift b/Projects/Core/DatabaseClient/Project.swift index e62e7ce..a2f1f4b 100644 --- a/Projects/Core/DatabaseClient/Project.swift +++ b/Projects/Core/DatabaseClient/Project.swift @@ -1,5 +1,5 @@ // -// DatabaseClientTesting.swift +// Project.swift // DatabaseClientManifests // // Created by devMinseok on 7/27/24. diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..f1cb98f --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "ICON_DEMO.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Resources/Assets.xcassets/contents.json b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Assets.xcassets/contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Assets.xcassets/contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Bold.otf b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Bold.otf new file mode 100644 index 0000000..a52ef39 Binary files /dev/null and b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Bold.otf differ diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Medium.otf b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Medium.otf new file mode 100644 index 0000000..a2dc009 Binary files /dev/null and b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Medium.otf differ diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Regular.otf b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Regular.otf new file mode 100644 index 0000000..c940185 Binary files /dev/null and b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-Regular.otf differ diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-SemiBold.otf b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-SemiBold.otf new file mode 100644 index 0000000..c375b54 Binary files /dev/null and b/Projects/Core/FeedbackGeneratorClient/Example/Resources/Font/Pretendard-SemiBold.otf differ diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Resources/LaunchScreen.storyboard b/Projects/Core/FeedbackGeneratorClient/Example/Resources/LaunchScreen.storyboard new file mode 100644 index 0000000..5a7df12 --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Example/Resources/LaunchScreen.storyboard @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Sources/ContentView.swift b/Projects/Core/FeedbackGeneratorClient/Example/Sources/ContentView.swift new file mode 100644 index 0000000..61a90f4 --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Example/Sources/ContentView.swift @@ -0,0 +1,98 @@ +// +// ContentView.swift +// FeedbackGeneratorClient +// +// Created by devMinseok on 8/16/24. +// + +import SwiftUI + +import Dependencies +import FeedbackGeneratorClientInterface + +struct ContentView: View { + @Dependency(FeedbackGeneratorClient.self) var feedbackGeneratorClient + + var body: some View { + NavigationStack { + List { + Button { + Task { + await feedbackGeneratorClient.impactOccurred(.heavy) + } + } label: { + Text("impactOccurred: heavy") + } + + Button { + Task { + await feedbackGeneratorClient.impactOccurred(.light) + } + } label: { + Text("impactOccurred: light") + } + + Button { + Task { + await feedbackGeneratorClient.impactOccurred(.medium) + } + } label: { + Text("impactOccurred: medium") + } + + Button { + Task { + await feedbackGeneratorClient.impactOccurred(.rigid) + } + } label: { + Text("impactOccurred: rigid") + } + + Button { + Task { + await feedbackGeneratorClient.impactOccurred(.soft) + } + } label: { + Text("impactOccurred: soft") + } + + Button { + Task { + await feedbackGeneratorClient.notification(.error) + } + } label: { + Text("notification: error") + } + + Button { + Task { + await feedbackGeneratorClient.notification(.success) + } + } label: { + Text("notification: success") + } + + Button { + Task { + await feedbackGeneratorClient.notification(.warning) + } + } label: { + Text("notification: warning") + } + + Button { + Task { + await feedbackGeneratorClient.selectionChanged() + } + } label: { + Text("selectionChanged") + } + } + .navigationTitle("FeedbackGenerator") + } + } +} + +#Preview { + ContentView() +} diff --git a/Projects/Core/FeedbackGeneratorClient/Example/Sources/FeedbackGeneratorClientApp.swift b/Projects/Core/FeedbackGeneratorClient/Example/Sources/FeedbackGeneratorClientApp.swift new file mode 100644 index 0000000..4ed0b58 --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Example/Sources/FeedbackGeneratorClientApp.swift @@ -0,0 +1,17 @@ +// +// FeedbackGeneratorClientApp.swift +// FeedbackGeneratorClient +// +// Created by devMinseok on 8/16/24. +// + +import SwiftUI + +@main +struct FeedbackGeneratorClientApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/Projects/Core/FeedbackGeneratorClient/Interface/FeedbackGeneratorClientInterface.swift b/Projects/Core/FeedbackGeneratorClient/Interface/FeedbackGeneratorClientInterface.swift new file mode 100644 index 0000000..f8fbe72 --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Interface/FeedbackGeneratorClientInterface.swift @@ -0,0 +1,23 @@ +// +// FeedbackGeneratorClientInterface.swift +// FeedbackGeneratorClient +// +// Created by devMinseok on 8/16/24. +// + +import UIKit + +import Dependencies +import DependenciesMacros + +@DependencyClient +public struct FeedbackGeneratorClient { + public var notification: @Sendable (UINotificationFeedbackGenerator.FeedbackType) async -> Void + public var selectionChanged: @Sendable () async -> Void + public var impactOccurred: @Sendable (UIImpactFeedbackGenerator.FeedbackStyle) async -> Void +} + +extension FeedbackGeneratorClient: TestDependencyKey { + public static let previewValue = Self() + public static let testValue = Self() +} diff --git a/Projects/Core/FeedbackGeneratorClient/Project.swift b/Projects/Core/FeedbackGeneratorClient/Project.swift new file mode 100644 index 0000000..c30bca0 --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Project.swift @@ -0,0 +1,28 @@ +// +// Project.swift +// FeedbackGeneratorClientManifests +// +// Created by devMinseok on 8/16/24. +// + +import ProjectDescription +import ProjectDescriptionHelpers + +@_spi(Core) +@_spi(Shared) +import DependencyPlugin + +let project: Project = .makeTMABasedProject( + module: Core.FeedbackGeneratorClient, + scripts: [], + targets: [ + .sources, + .interface, + .example + ], + dependencies: [ + .interface: [ + .dependency(rootModule: Shared.self) + ] + ] +) diff --git a/Projects/Core/FeedbackGeneratorClient/Sources/FeedbackGeneratorClient.swift b/Projects/Core/FeedbackGeneratorClient/Sources/FeedbackGeneratorClient.swift new file mode 100644 index 0000000..41917b8 --- /dev/null +++ b/Projects/Core/FeedbackGeneratorClient/Sources/FeedbackGeneratorClient.swift @@ -0,0 +1,33 @@ +// +// FeedbackGeneratorClient.swift +// FeedbackGeneratorClient +// +// Created by devMinseok on 8/16/24. +// + +import UIKit + +import FeedbackGeneratorClientInterface + +import Dependencies + +extension FeedbackGeneratorClient: DependencyKey { + public static let liveValue: FeedbackGeneratorClient = .live() + + public static func live() -> FeedbackGeneratorClient { + return .init( + notification: { type in + let generator = await UINotificationFeedbackGenerator() + await generator.notificationOccurred(type) + }, + selectionChanged: { + let generator = await UISelectionFeedbackGenerator() + await generator.selectionChanged() + }, + impactOccurred: { style in + let generator = await UIImpactFeedbackGenerator(style: style) + await generator.impactOccurred() + } + ) + } +} diff --git a/Projects/Core/KeychainClient/Project.swift b/Projects/Core/KeychainClient/Project.swift index 7ae4da7..1e359a7 100644 --- a/Projects/Core/KeychainClient/Project.swift +++ b/Projects/Core/KeychainClient/Project.swift @@ -1,3 +1,10 @@ +// +// Project.swift +// KeychainClientManifests +// +// Created by devMinseok on 8/16/24. +// + import ProjectDescription import ProjectDescriptionHelpers diff --git a/Projects/Core/UserDefaultsClient/Project.swift b/Projects/Core/UserDefaultsClient/Project.swift index 845d9e7..daeb66a 100644 --- a/Projects/Core/UserDefaultsClient/Project.swift +++ b/Projects/Core/UserDefaultsClient/Project.swift @@ -1,5 +1,5 @@ // -// UserDefaultsClientTesting.swift +// Project.swift // UserDefaultsClientManifests // // Created by devMinseok on 8/4/24. diff --git a/Projects/Core/UserNotificationClient/Project.swift b/Projects/Core/UserNotificationClient/Project.swift index 8d67d9d..0b9807d 100644 --- a/Projects/Core/UserNotificationClient/Project.swift +++ b/Projects/Core/UserNotificationClient/Project.swift @@ -1,3 +1,10 @@ +// +// Project.swift +// UserNotificationClientManifests +// +// Created by devMinseok on 8/16/24. +// + import ProjectDescription import ProjectDescriptionHelpers diff --git a/Tuist/Templates/Framework/Stencil/Project.stencil b/Tuist/Templates/Framework/Stencil/Project.stencil index c0e5791..ee9ffac 100644 --- a/Tuist/Templates/Framework/Stencil/Project.stencil +++ b/Tuist/Templates/Framework/Stencil/Project.stencil @@ -1,5 +1,5 @@ // -// {{ name }}Testing.swift +// Project.swift // {{ name }}Manifests // // Created by <#T##Author name#> on {{ nowDate }}.