Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
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
Material
Commits
16d1f535
Commit
16d1f535
authored
Oct 04, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow setting Theme.current directly
parent
848d5a3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
Sources/iOS/Theme.swift
+16
-9
No files found.
Sources/iOS/Theme.swift
View file @
16d1f535
...
...
@@ -70,15 +70,7 @@ public struct Theme {
public
extension
Theme
{
/// Current theme for Material.
static
var
current
=
Theme
.
light
{
didSet
{
guard
let
v
=
Application
.
rootViewController
else
{
return
}
apply
(
theme
:
.
current
,
to
:
v
)
}
}
static
private(set)
var
current
=
Theme
.
light
/// A light theme.
static
var
light
=
Theme
()
...
...
@@ -92,6 +84,21 @@ public extension Theme {
t
.
onBackground
=
.
white
return
t
}()
}
public
extension
Theme
{
/**
Applies theme to the entire app.
- Parameter theme: A Theme.
*/
static
func
apply
(
theme
:
Theme
)
{
guard
let
v
=
Application
.
rootViewController
else
{
return
}
current
=
theme
apply
(
theme
:
theme
,
to
:
v
)
}
/**
Applies theme to the hierarchy of given view.
...
...
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