-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/#25: live activity 구현
- Loading branch information
Showing
10 changed files
with
383 additions
and
3 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
LiveTimeWidget/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
LiveTimeWidget/Assets.xcassets/CustomGreen.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0.110", | ||
"green" : "0.867", | ||
"red" : "0.498" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
LiveTimeWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.widgetkit-extension</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// LiveTimeWidget.swift | ||
// LiveTimeWidget | ||
// | ||
// Created by Groo on 5/20/24. | ||
// | ||
|
||
import WidgetKit | ||
import SwiftUI | ||
import ActivityKit | ||
|
||
struct LiveTimeWidget: Widget { | ||
var body: some WidgetConfiguration { | ||
ActivityConfiguration(for: LiveTimeAttributes.self) { context in | ||
HStack { | ||
Image(systemName: "leaf.fill") | ||
.foregroundStyle(.customGreen) | ||
Text("잔디를 심을 시간이에요!") | ||
Spacer() | ||
Text(context.state.restOfTime, style: .relative) | ||
.foregroundStyle(.customGreen) | ||
.frame(width: 77, height: 30) | ||
} | ||
.padding() | ||
} dynamicIsland: { context in | ||
DynamicIsland { | ||
DynamicIslandExpandedRegion(.bottom) { | ||
VStack { | ||
Text("잔디 심을 시간이에요!") | ||
Text(context.state.restOfTime, style: .relative) | ||
.foregroundStyle(.customGreen) | ||
Button("click") {} | ||
.tint(.customGreen) | ||
} | ||
.padding() | ||
} | ||
} compactLeading: { | ||
Image(systemName: "leaf.fill") | ||
.foregroundStyle(.customGreen) | ||
} compactTrailing: { | ||
Text(context.state.restOfTime, style: .relative) | ||
.foregroundStyle(.customGreen) | ||
.frame(width: 66) | ||
} minimal: { | ||
Text(context.state.restOfTime, style: .relative) | ||
.foregroundStyle(.customGreen) | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct TimeWidgetView: View { | ||
let context: ActivityViewContext<LiveTimeAttributes> | ||
|
||
var body: some View { | ||
Text(context.state.restOfTime, style: .relative) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// LiveTimeWidgetBundle.swift | ||
// LiveTimeWidget | ||
// | ||
// Created by Groo on 5/20/24. | ||
// | ||
|
||
import WidgetKit | ||
import SwiftUI | ||
|
||
@main | ||
struct LiveTimeWidgetBundle: WidgetBundle { | ||
var body: some Widget { | ||
LiveTimeWidget() | ||
} | ||
} |
Oops, something went wrong.