Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
8e8117b3
Commit
8e8117b3
authored
May 28, 2021
by
Dmitriy Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added widget extension
parent
4656d2b3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
228 additions
and
1 deletions
+228
-1
1Weather.xcodeproj/project.pbxproj
+0
-0
1Weather.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
+6
-1
OneWeatherWidget/Assets.xcassets/AccentColor.colorset/Contents.json
+11
-0
OneWeatherWidget/Assets.xcassets/AppIcon.appiconset/Contents.json
+98
-0
OneWeatherWidget/Assets.xcassets/Contents.json
+6
-0
OneWeatherWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json
+11
-0
OneWeatherWidget/Info.plist
+29
-0
OneWeatherWidget/OneWeatherWidget.swift
+67
-0
No files found.
1Weather.xcodeproj/project.pbxproj
View file @
8e8117b3
This diff is collapsed.
Click to expand it.
1Weather.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
8e8117b3
...
@@ -12,7 +12,12 @@
...
@@ -12,7 +12,12 @@
<
k
e
y
>
OneWeatherNotificationServiceExtension.xcscheme_
^#
shared
#^
_
<
/k
e
y
>
<
k
e
y
>
OneWeatherNotificationServiceExtension.xcscheme_
^#
shared
#^
_
<
/k
e
y
>
<
d
i
c
t
>
<
d
i
c
t
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
49
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
51
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
OneWeatherWidgetExtension.xcscheme_
^#
shared
#^
_
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
58
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
k
e
y
>
PG
(
Playground
)
1.xcscheme
<
/k
e
y
>
<
k
e
y
>
PG
(
Playground
)
1.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
d
i
c
t
>
...
...
OneWeatherWidget/Assets.xcassets/AccentColor.colorset/Contents.json
0 → 100644
View file @
8e8117b3
{
"colors"
:
[
{
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
OneWeatherWidget/Assets.xcassets/AppIcon.appiconset/Contents.json
0 → 100644
View file @
8e8117b3
{
"images"
:
[
{
"idiom"
:
"iphone"
,
"scale"
:
"2x"
,
"size"
:
"20x20"
},
{
"idiom"
:
"iphone"
,
"scale"
:
"3x"
,
"size"
:
"20x20"
},
{
"idiom"
:
"iphone"
,
"scale"
:
"2x"
,
"size"
:
"29x29"
},
{
"idiom"
:
"iphone"
,
"scale"
:
"3x"
,
"size"
:
"29x29"
},
{
"idiom"
:
"iphone"
,
"scale"
:
"2x"
,
"size"
:
"40x40"
},
{
"idiom"
:
"iphone"
,
"scale"
:
"3x"
,
"size"
:
"40x40"
},
{
"idiom"
:
"iphone"
,
"scale"
:
"2x"
,
"size"
:
"60x60"
},
{
"idiom"
:
"iphone"
,
"scale"
:
"3x"
,
"size"
:
"60x60"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"1x"
,
"size"
:
"20x20"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"2x"
,
"size"
:
"20x20"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"1x"
,
"size"
:
"29x29"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"2x"
,
"size"
:
"29x29"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"1x"
,
"size"
:
"40x40"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"2x"
,
"size"
:
"40x40"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"1x"
,
"size"
:
"76x76"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"2x"
,
"size"
:
"76x76"
},
{
"idiom"
:
"ipad"
,
"scale"
:
"2x"
,
"size"
:
"83.5x83.5"
},
{
"idiom"
:
"ios-marketing"
,
"scale"
:
"1x"
,
"size"
:
"1024x1024"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
OneWeatherWidget/Assets.xcassets/Contents.json
0 → 100644
View file @
8e8117b3
{
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
OneWeatherWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json
0 → 100644
View file @
8e8117b3
{
"colors"
:
[
{
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
OneWeatherWidget/Info.plist
0 → 100644
View file @
8e8117b3
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
$
(
DEVELOPMENT_LANGUAGE
)<
/string
>
<
k
e
y
>
CFBundleDisplayName
<
/k
e
y
>
<
string
>
OneWeatherWidget
<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
<
string
>
$
(
PRODUCT_BUNDLE_IDENTIFIER
)<
/string
>
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
$
(
PRODUCT_NAME
)<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
$
(
PRODUCT_BUNDLE_PACKAGE_TYPE
)<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.0
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
k
e
y
>
NSExtension
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSExtensionPointIdentifier
<
/k
e
y
>
<
string
>
com.apple.widgetkit-extension
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
OneWeatherWidget/OneWeatherWidget.swift
0 → 100644
View file @
8e8117b3
//
// OneWeatherWidget.swift
// OneWeatherWidget
//
// Created by Dmitry Stepanets on 28.05.2021.
//
import
WidgetKit
import
SwiftUI
struct
Provider
:
TimelineProvider
{
func
placeholder
(
in
context
:
Context
)
->
SimpleEntry
{
SimpleEntry
(
date
:
Date
())
}
func
getSnapshot
(
in
context
:
Context
,
completion
:
@escaping
(
SimpleEntry
)
->
())
{
let
entry
=
SimpleEntry
(
date
:
Date
())
completion
(
entry
)
}
func
getTimeline
(
in
context
:
Context
,
completion
:
@escaping
(
Timeline
<
Entry
>
)
->
())
{
var
entries
:
[
SimpleEntry
]
=
[]
// Generate a timeline consisting of five entries an hour apart, starting from the current date.
let
currentDate
=
Date
()
for
hourOffset
in
0
..<
5
{
let
entryDate
=
Calendar
.
current
.
date
(
byAdding
:
.
hour
,
value
:
hourOffset
,
to
:
currentDate
)
!
let
entry
=
SimpleEntry
(
date
:
entryDate
)
entries
.
append
(
entry
)
}
let
timeline
=
Timeline
(
entries
:
entries
,
policy
:
.
atEnd
)
completion
(
timeline
)
}
}
struct
SimpleEntry
:
TimelineEntry
{
let
date
:
Date
}
struct
OneWeatherWidgetEntryView
:
View
{
var
entry
:
Provider
.
Entry
var
body
:
some
View
{
Text
(
entry
.
date
,
style
:
.
time
)
}
}
@main
struct
OneWeatherWidget
:
Widget
{
let
kind
:
String
=
"OneWeatherWidget"
var
body
:
some
WidgetConfiguration
{
StaticConfiguration
(
kind
:
kind
,
provider
:
Provider
())
{
entry
in
OneWeatherWidgetEntryView
(
entry
:
entry
)
}
.
configurationDisplayName
(
"My Widget"
)
.
description
(
"This is an example widget."
)
}
}
struct
OneWeatherWidget_Previews
:
PreviewProvider
{
static
var
previews
:
some
View
{
OneWeatherWidgetEntryView
(
entry
:
SimpleEntry
(
date
:
Date
()))
.
previewContext
(
WidgetPreviewContext
(
family
:
.
systemSmall
))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment