Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
PogodaNet/OnboardingViewController.swift at main · Setelite/PogodaNet · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Setelite
PogodaNet
Repository navigation
Code
Issues
Pull requests
1
(1)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
PogodaNet
/
OnboardingViewController.swift
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
135 lines (113 loc) · 5.51 KB
main
Breadcrumbs
PogodaNet
/
OnboardingViewController.swift
Copy path
Top
File metadata and controls
Code
Blame
135 lines (113 loc) · 5.51 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//
// OnboardingViewController.swift
// Pogoda Net
//
// Created by MAXIM GORNOSTAEV on 2/9/26.
//
import
UIKit
import
CoreLocation
final
class
OnboardingViewController
:
UIViewController
{
private
let
locationManager
=
CLLocationManager
(
)
private
let
allowButton
=
UIButton
(
type
:
.
system
)
private
let
skipButton
=
UIButton
(
type
:
.
system
)
private
let
illustrationView
=
UIImageView
(
image
:
UIImage
(
named
:
"
onboarding_illustration
"
)
)
private
let
titleImageView
=
UIImageView
(
image
:
UIImage
(
named
:
"
onboarding_title
"
)
)
private
let
descriptionImageView1
=
UIImageView
(
image
:
UIImage
(
named
:
"
onboarding_desc_1
"
)
)
private
let
descriptionImageView2
=
UIImageView
(
image
:
UIImage
(
named
:
"
onboarding_desc_2
"
)
)
override
func
viewDidLoad
(
)
{
super
.
viewDidLoad
(
)
view
.
backgroundColor
=
UIColor
(
red
:
0.13
,
green
:
0.31
,
blue
:
0.78
,
alpha
:
1
)
locationManager
.
delegate
=
self
setupUI
(
)
}
private
func
setupUI
(
)
{
[
illustrationView
,
titleImageView
,
descriptionImageView1
,
descriptionImageView2
]
.
forEach
{
$0
.
translatesAutoresizingMaskIntoConstraints
=
false
$0
.
contentMode
=
.
scaleAspectFit
view
.
addSubview
(
$0
)
}
allowButton
.
configuration
=
.
plain
(
)
allowButton
.
setImage
(
UIImage
(
named
:
"
onboarding_allow_button
"
)
,
for
:
.
normal
)
allowButton
.
tintColor
=
.
clear
allowButton
.
adjustsImageWhenHighlighted
=
true
allowButton
.
translatesAutoresizingMaskIntoConstraints
=
false
allowButton
.
addTarget
(
self
,
action
:
#selector
(
requestLocation
)
,
for
:
.
touchUpInside
)
skipButton
.
configuration
=
.
plain
(
)
skipButton
.
setImage
(
UIImage
(
named
:
"
onboarding_skip
"
)
,
for
:
.
normal
)
skipButton
.
tintColor
=
.
clear
skipButton
.
adjustsImageWhenHighlighted
=
true
skipButton
.
translatesAutoresizingMaskIntoConstraints
=
false
skipButton
.
addTarget
(
self
,
action
:
#selector
(
skipTapped
)
,
for
:
.
touchUpInside
)
view
.
addSubview
(
allowButton
)
view
.
addSubview
(
skipButton
)
NSLayoutConstraint
.
activate
(
[
illustrationView
.
topAnchor
.
constraint
(
equalTo
:
view
.
safeAreaLayoutGuide
.
topAnchor
,
constant
:
42
)
,
illustrationView
.
centerXAnchor
.
constraint
(
equalTo
:
view
.
centerXAnchor
)
,
illustrationView
.
widthAnchor
.
constraint
(
equalToConstant
:
180
)
,
illustrationView
.
heightAnchor
.
constraint
(
equalToConstant
:
196
)
,
titleImageView
.
topAnchor
.
constraint
(
equalTo
:
illustrationView
.
bottomAnchor
,
constant
:
22
)
,
titleImageView
.
centerXAnchor
.
constraint
(
equalTo
:
view
.
centerXAnchor
)
,
titleImageView
.
widthAnchor
.
constraint
(
equalToConstant
:
317
)
,
titleImageView
.
heightAnchor
.
constraint
(
equalToConstant
:
57
)
,
descriptionImageView1
.
topAnchor
.
constraint
(
equalTo
:
titleImageView
.
bottomAnchor
,
constant
:
15
)
,
descriptionImageView1
.
centerXAnchor
.
constraint
(
equalTo
:
view
.
centerXAnchor
)
,
descriptionImageView1
.
widthAnchor
.
constraint
(
equalToConstant
:
309
)
,
descriptionImageView1
.
heightAnchor
.
constraint
(
equalToConstant
:
32
)
,
descriptionImageView2
.
topAnchor
.
constraint
(
equalTo
:
descriptionImageView1
.
bottomAnchor
,
constant
:
7
)
,
descriptionImageView2
.
centerXAnchor
.
constraint
(
equalTo
:
view
.
centerXAnchor
)
,
descriptionImageView2
.
widthAnchor
.
constraint
(
equalToConstant
:
290
)
,
descriptionImageView2
.
heightAnchor
.
constraint
(
equalToConstant
:
32
)
,
allowButton
.
leadingAnchor
.
constraint
(
equalTo
:
view
.
leadingAnchor
,
constant
:
18
)
,
allowButton
.
trailingAnchor
.
constraint
(
equalTo
:
view
.
trailingAnchor
,
constant
:
-
17
)
,
allowButton
.
heightAnchor
.
constraint
(
equalToConstant
:
40
)
,
allowButton
.
bottomAnchor
.
constraint
(
equalTo
:
skipButton
.
topAnchor
,
constant
:
-
18
)
,
skipButton
.
centerXAnchor
.
constraint
(
equalTo
:
view
.
centerXAnchor
)
,
skipButton
.
widthAnchor
.
constraint
(
equalToConstant
:
276
)
,
skipButton
.
heightAnchor
.
constraint
(
equalToConstant
:
14
)
,
skipButton
.
bottomAnchor
.
constraint
(
equalTo
:
view
.
safeAreaLayoutGuide
.
bottomAnchor
,
constant
:
-
20
)
]
)
}
@
objc
private
func
requestLocation
(
)
{
switch
locationManager
.
authorizationStatus
{
case
.
authorizedWhenInUse
,
.
authorizedAlways
:
goToMain
(
)
case
.
denied
,
.
restricted
:
goToMain
(
)
case
.
notDetermined
:
locationManager
.
requestWhenInUseAuthorization
(
)
@
unknown
default
:
goToMain
(
)
}
}
@
objc
private
func
skipTapped
(
)
{
goToMain
(
)
}
}
extension
OnboardingViewController
:
CLLocationManagerDelegate
{
func
locationManagerDidChangeAuthorization
(
_ manager
:
CLLocationManager
)
{
handleAuthorization
(
manager
.
authorizationStatus
)
}
func
locationManager
(
_ manager
:
CLLocationManager
,
didChangeAuthorization status
:
CLAuthorizationStatus
)
{
handleAuthorization
(
status
)
}
private
func
handleAuthorization
(
_ status
:
CLAuthorizationStatus
)
{
switch
status
{
case
.
authorizedWhenInUse
,
.
authorizedAlways
:
goToMain
(
)
case
.
denied
,
.
restricted
:
goToMain
(
)
default
:
break
}
}
private
func
goToMain
(
)
{
UserDefaults
.
standard
.
set
(
true
,
forKey
:
"
didShowOnboarding
"
)
let
main
=
MainViewController
(
)
let
navigation
=
UINavigationController
(
rootViewController
:
main
)
navigation
.
modalPresentationStyle
=
.
fullScreen
present
(
navigation
,
animated
:
true
)
}
}
You can’t perform that action at this time.