From 44eb9d185a402f5521f096421289c0594734f273 Mon Sep 17 00:00:00 2001 From: doyeonKim Date: Thu, 17 Oct 2024 00:39:06 +0900 Subject: [PATCH] =?UTF-8?q?[D-0]=20Dev=20Scheme=20=EC=B6=94=EA=B0=80=20(#7?= =?UTF-8?q?6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add: dev scheme 추가 * add: fastfile Dev 업로드 추가 * feat: dev upload를 위해 workflows 수정 * chore: marketingVersion 1.2.1 -> 1.2.2 --- Projects/App/Project.swift | 18 ++++++- .../Resources/WidgetExtension-Info.plist | 29 +++++++++++ .../Sources/MainWidget/MainWidget.swift | 50 +++++++++++++++++++ .../Sources/OCRWidget/MyWidget.swift | 50 +++++++++++++++++++ .../Sources/SecondWidget/SecondWidget.swift | 50 +++++++++++++++++++ .../App/WidgetExtension/Sources/Widgets.swift | 12 +++++ 6 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 Projects/App/WidgetExtension/Resources/WidgetExtension-Info.plist create mode 100644 Projects/App/WidgetExtension/Sources/MainWidget/MainWidget.swift create mode 100644 Projects/App/WidgetExtension/Sources/OCRWidget/MyWidget.swift create mode 100644 Projects/App/WidgetExtension/Sources/SecondWidget/SecondWidget.swift create mode 100644 Projects/App/WidgetExtension/Sources/Widgets.swift diff --git a/Projects/App/Project.swift b/Projects/App/Project.swift index f8393aa..681300a 100644 --- a/Projects/App/Project.swift +++ b/Projects/App/Project.swift @@ -18,6 +18,21 @@ let project = Project( ] ), targets: [ + .init( + name: "WidgetExtension", + platform: .iOS, + product: .appExtension, + bundleId: "com.yapp.moneymong.WidgetExtension", + infoPlist: .extendingDefault(with: [ + "CFBundleDisplayName": "$(PRODUCT_NAME)", + "NSExtension": [ + "NSExtensionPointIdentifier": "com.apple.widgetkit-extension", + ], + ]), + sources: "WidgetExtension/Sources/**", + resources: "WidgetExtension/Resources/**", + dependencies: [] + ), Target( name: "Moneymong", platform: .iOS, @@ -63,7 +78,8 @@ let project = Project( entitlements: "Resources/App.entitlements", dependencies: [ .project(target: "SignFeature", path: .relativeToRoot("Projects/Feature/Sign")), - .project(target: "MainFeature", path: .relativeToRoot("Projects/Feature/Main")) + .project(target: "MainFeature", path: .relativeToRoot("Projects/Feature/Main")), + .target(name: "WidgetExtension") ], settings: .settings( base: .init() diff --git a/Projects/App/WidgetExtension/Resources/WidgetExtension-Info.plist b/Projects/App/WidgetExtension/Resources/WidgetExtension-Info.plist new file mode 100644 index 0000000..3cc95de --- /dev/null +++ b/Projects/App/WidgetExtension/Resources/WidgetExtension-Info.plist @@ -0,0 +1,29 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + $(PRODUCT_NAME) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSExtension + + NSExtensionPointIdentifier + com.apple.widgetkit-extension + + + diff --git a/Projects/App/WidgetExtension/Sources/MainWidget/MainWidget.swift b/Projects/App/WidgetExtension/Sources/MainWidget/MainWidget.swift new file mode 100644 index 0000000..1951f12 --- /dev/null +++ b/Projects/App/WidgetExtension/Sources/MainWidget/MainWidget.swift @@ -0,0 +1,50 @@ +import WidgetKit +import SwiftUI + +struct MainWidget: Widget { + let kind: String = "MainWidget" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: MainProvider()) { entry in + MainWidgetEntryView(entry: entry) + } + .supportedFamilies([.systemMedium]) + .configurationDisplayName("My Widget") + .description("This is an example widget.") + } +} + +struct MainWidgetEntryView: View { + var entry: MainProvider.Entry + + var body: some View { + Text(entry.date, style: .time) + } +} + +struct MainSimpleEntry: TimelineEntry { + let date: Date +} + +struct MainProvider: TimelineProvider { + func placeholder(in context: Context) -> MainSimpleEntry { + MainSimpleEntry(date: Date()) + } + + func getSnapshot(in context: Context, completion: @escaping (MainSimpleEntry) -> ()) { + let entry = MainSimpleEntry(date: Date()) + completion(entry) + } + + func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) { + var entries: [MainSimpleEntry] = [] + let currentDate = Date() + for hourOffset in 0..<5 { + let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)! + let entry = MainSimpleEntry(date: entryDate) + entries.append(entry) + } + let timeline = Timeline(entries: entries, policy: .atEnd) + completion(timeline) + } +} diff --git a/Projects/App/WidgetExtension/Sources/OCRWidget/MyWidget.swift b/Projects/App/WidgetExtension/Sources/OCRWidget/MyWidget.swift new file mode 100644 index 0000000..72e104c --- /dev/null +++ b/Projects/App/WidgetExtension/Sources/OCRWidget/MyWidget.swift @@ -0,0 +1,50 @@ +import WidgetKit +import SwiftUI + +struct OCRWidget: Widget { + let kind: String = "OCRWidget" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: OCRProvider()) { entry in + OCRWidgetEntryView(entry: entry) + } + .supportedFamilies([.systemSmall]) + .configurationDisplayName("My Widget") + .description("This is an example widget.") + } +} + +struct OCRWidgetEntryView: View { + var entry: OCRProvider.Entry + + var body: some View { + Text(entry.date, style: .time) + } +} + +struct OCRSimpleEntry: TimelineEntry { + let date: Date +} + +struct OCRProvider: TimelineProvider { + func placeholder(in context: Context) -> OCRSimpleEntry { + OCRSimpleEntry(date: Date()) + } + + func getSnapshot(in context: Context, completion: @escaping (OCRSimpleEntry) -> ()) { + let entry = OCRSimpleEntry(date: Date()) + completion(entry) + } + + func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) { + var entries: [OCRSimpleEntry] = [] + let currentDate = Date() + for hourOffset in 0..<5 { + let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)! + let entry = OCRSimpleEntry(date: entryDate) + entries.append(entry) + } + let timeline = Timeline(entries: entries, policy: .atEnd) + completion(timeline) + } +} diff --git a/Projects/App/WidgetExtension/Sources/SecondWidget/SecondWidget.swift b/Projects/App/WidgetExtension/Sources/SecondWidget/SecondWidget.swift new file mode 100644 index 0000000..3a89824 --- /dev/null +++ b/Projects/App/WidgetExtension/Sources/SecondWidget/SecondWidget.swift @@ -0,0 +1,50 @@ +import WidgetKit +import SwiftUI + +struct SecondWidget: Widget { + let kind: String = "SecondWidget" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: SecondProvider()) { entry in + SecondWidgetEntryView(entry: entry) + } + .supportedFamilies([.systemMedium]) + .configurationDisplayName("My Widget") + .description("This is an example widget.") + } +} + +struct SecondWidgetEntryView: View { + var entry: SecondProvider.Entry + + var body: some View { + Text(entry.date, style: .time) + } +} + +struct SecondSimpleEntry: TimelineEntry { + let date: Date +} + +struct SecondProvider: TimelineProvider { + func placeholder(in context: Context) -> SecondSimpleEntry { + SecondSimpleEntry(date: Date()) + } + + func getSnapshot(in context: Context, completion: @escaping (SecondSimpleEntry) -> ()) { + let entry = SecondSimpleEntry(date: Date()) + completion(entry) + } + + func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) { + var entries: [SecondSimpleEntry] = [] + let currentDate = Date() + for hourOffset in 0..<5 { + let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)! + let entry = SecondSimpleEntry(date: entryDate) + entries.append(entry) + } + let timeline = Timeline(entries: entries, policy: .atEnd) + completion(timeline) + } +} diff --git a/Projects/App/WidgetExtension/Sources/Widgets.swift b/Projects/App/WidgetExtension/Sources/Widgets.swift new file mode 100644 index 0000000..78c42b1 --- /dev/null +++ b/Projects/App/WidgetExtension/Sources/Widgets.swift @@ -0,0 +1,12 @@ +import SwiftUI +import WidgetKit + +@main +struct Widgets: WidgetBundle { + @WidgetBundleBuilder + var body: some Widget { + MainWidget() + SecondWidget() + OCRWidget() + } +}