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
d82a9cd3
Unverified
Commit
d82a9cd3
authored
Sep 10, 2018
by
Daniel Dahan
Committed by
GitHub
Sep 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1147 from ConfusedVorlon/support_extensions_squash
Support extensions
parents
c9fb3f6f
1c0ad9a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
Sources/iOS/Application.swift
+21
-8
No files found.
Sources/iOS/Application.swift
View file @
d82a9cd3
...
...
@@ -31,9 +31,22 @@
import
UIKit
public
struct
Application
{
/// A reference to UIApplication.shared application which doesn't trigger linker errors when Material is included in an extension
/// Note that this will crash if actually called from within an extension
public
static
var
shared
:
UIApplication
{
let
sharedSelector
=
NSSelectorFromString
(
"sharedApplication"
)
guard
UIApplication
.
responds
(
to
:
sharedSelector
)
else
{
fatalError
(
"[Material: Extensions cannot access Application]"
)
}
let
shared
=
UIApplication
.
perform
(
sharedSelector
)
return
shared
?
.
takeUnretainedValue
()
as!
UIApplication
}
/// An optional reference to the main UIWindow.
public
static
var
keyWindow
:
UIWindow
?
{
return
UI
Application
.
shared
.
keyWindow
return
Application
.
shared
.
keyWindow
}
/// An optional reference to the top most view controller.
...
...
@@ -43,7 +56,7 @@ public struct Application {
/// A boolean indicating if the device is in Landscape mode.
public
static
var
isLandscape
:
Bool
{
return
UI
Application
.
shared
.
statusBarOrientation
.
isLandscape
return
Application
.
shared
.
statusBarOrientation
.
isLandscape
}
/// A boolean indicating if the device is in Portrait mode.
...
...
@@ -53,26 +66,26 @@ public struct Application {
/// The current UIInterfaceOrientation value.
public
static
var
orientation
:
UIInterfaceOrientation
{
return
UI
Application
.
shared
.
statusBarOrientation
return
Application
.
shared
.
statusBarOrientation
}
/// Retrieves the device status bar style.
public
static
var
statusBarStyle
:
UIStatusBarStyle
{
get
{
return
UI
Application
.
shared
.
statusBarStyle
return
Application
.
shared
.
statusBarStyle
}
set
(
value
)
{
UI
Application
.
shared
.
statusBarStyle
=
value
Application
.
shared
.
statusBarStyle
=
value
}
}
/// Retrieves the device status bar hidden state.
public
static
var
isStatusBarHidden
:
Bool
{
get
{
return
UI
Application
.
shared
.
isStatusBarHidden
return
Application
.
shared
.
isStatusBarHidden
}
set
(
value
)
{
UI
Application
.
shared
.
isStatusBarHidden
=
value
Application
.
shared
.
isStatusBarHidden
=
value
}
}
...
...
@@ -86,6 +99,6 @@ public struct Application {
/// A reference to the user interface layout direction.
public
static
var
userInterfaceLayoutDirection
:
UIUserInterfaceLayoutDirection
{
return
UI
Application
.
shared
.
userInterfaceLayoutDirection
return
Application
.
shared
.
userInterfaceLayoutDirection
}
}
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