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
09f0557e
Commit
09f0557e
authored
Oct 21, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix occasional crash due to working with the UI from a background thread.
parent
ef2c8a96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
1Weather/UI/View controllers/Today/TodayViewController.swift
+15
-7
No files found.
1Weather/UI/View controllers/Today/TodayViewController.swift
View file @
09f0557e
...
...
@@ -8,6 +8,7 @@
import
UIKit
import
CoreLocation
import
OneWeatherAnalytics
import
OneWeatherCore
class
TodayViewController
:
UIViewController
{
//Private
...
...
@@ -63,8 +64,10 @@ class TodayViewController: UIViewController {
override
func
viewWillTransition
(
to
size
:
CGSize
,
with
coordinator
:
UIViewControllerTransitionCoordinator
)
{
super
.
viewWillTransition
(
to
:
size
,
with
:
coordinator
)
coordinator
.
animate
{
_
in
self
.
tableView
.
reloadData
()
onMain
{
coordinator
.
animate
{
_
in
self
.
tableView
.
reloadData
()
}
}
}
...
...
@@ -82,7 +85,10 @@ private extension TodayViewController {
view
.
backgroundColor
=
ThemeManager
.
currentTheme
.
baseBackgroundColor
localizationObserver
=
NotificationCenter
.
default
.
addObserver
(
forName
:
.
localizationChange
,
object
:
nil
,
queue
:
.
main
,
using
:
{
[
weak
self
]
_
in
self
?
.
tableView
.
reloadData
()
onMain
{
self
?
.
tableView
.
reloadData
()
}
})
}
...
...
@@ -176,10 +182,12 @@ extension TodayViewController: TodayViewModelDelegate {
}
func
viewModelDidChange
<
P
>
(
model
:
P
)
where
P
:
ViewModelProtocol
{
cityButton
.
configure
(
with
:
viewModel
.
location
)
cityButton
.
isHidden
=
false
tableView
.
isHidden
=
false
tableView
.
reloadData
()
onMain
{
self
.
cityButton
.
configure
(
with
:
self
.
viewModel
.
location
)
self
.
cityButton
.
isHidden
=
false
self
.
tableView
.
isHidden
=
false
self
.
tableView
.
reloadData
()
}
}
}
...
...
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