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
dc110fd1
Commit
dc110fd1
authored
Aug 03, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetches a given view controller type based on the return type of the property value
parent
a77657d6
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
73 additions
and
69 deletions
+73
-69
Material.xcodeproj/project.pbxproj
+4
-0
Sources/Info.plist
+1
-1
Sources/iOS/FABMenuController.swift
+1
-8
Sources/iOS/Material+UIViewController.swift
+49
-0
Sources/iOS/NavigationDrawerController.swift
+5
-12
Sources/iOS/SearchBarController.swift
+5
-12
Sources/iOS/SnackbarController.swift
+1
-8
Sources/iOS/StatusBarController.swift
+1
-8
Sources/iOS/TabsController.swift
+1
-8
Sources/iOS/ToolbarController.swift
+5
-12
No files found.
Material.xcodeproj/project.pbxproj
View file @
dc110fd1
...
@@ -99,6 +99,7 @@
...
@@ -99,6 +99,7 @@
965E81211DD4D5C800D61E4B
/* TextStorage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB79D1CB40DC500C806FE
/* TextStorage.swift */
;
};
965E81211DD4D5C800D61E4B
/* TextStorage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB79D1CB40DC500C806FE
/* TextStorage.swift */
;
};
965E81221DD4D5C800D61E4B
/* TextView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB79E1CB40DC500C806FE
/* TextView.swift */
;
};
965E81221DD4D5C800D61E4B
/* TextView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB79E1CB40DC500C806FE
/* TextView.swift */
;
};
965E81261DD4D7C800D61E4B
/* CharacterAttribute.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961276621DCD8B1800A7D920
/* CharacterAttribute.swift */
;
};
965E81261DD4D7C800D61E4B
/* CharacterAttribute.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961276621DCD8B1800A7D920
/* CharacterAttribute.swift */
;
};
9667A2491F33D5E200C45078
/* Material+UIViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9667A2481F33D5E200C45078
/* Material+UIViewController.swift */
;
};
966C17731F0439F600D3E83C
/* Material+MotionAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966C17721F0439F600D3E83C
/* Material+MotionAnimation.swift */
;
};
966C17731F0439F600D3E83C
/* Material+MotionAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966C17721F0439F600D3E83C
/* Material+MotionAnimation.swift */
;
};
9685D5AF1F0F04CB00AFEB79
/* CardCollectionViewCell.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656895E1F002F16001C656D
/* CardCollectionViewCell.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9685D5AF1F0F04CB00AFEB79
/* CardCollectionViewCell.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656895E1F002F16001C656D
/* CardCollectionViewCell.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9685D5B01F0F04CB00AFEB79
/* CardCollectionViewController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965689601F002F4C001C656D
/* CardCollectionViewController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9685D5B01F0F04CB00AFEB79
/* CardCollectionViewController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965689601F002F4C001C656D
/* CardCollectionViewController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
@@ -229,6 +230,7 @@
...
@@ -229,6 +230,7 @@
9656895E1F002F16001C656D
/* CardCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CardCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
9656895E1F002F16001C656D
/* CardCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CardCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
965689601F002F4C001C656D
/* CardCollectionViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CardCollectionViewController.swift
;
sourceTree
=
"<group>"
;
};
965689601F002F4C001C656D
/* CardCollectionViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CardCollectionViewController.swift
;
sourceTree
=
"<group>"
;
};
9658F2161CD6FA4700B902C1
/* IconButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
IconButton.swift
;
sourceTree
=
"<group>"
;
};
9658F2161CD6FA4700B902C1
/* IconButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
IconButton.swift
;
sourceTree
=
"<group>"
;
};
9667A2481F33D5E200C45078
/* Material+UIViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIViewController.swift"
;
sourceTree
=
"<group>"
;
};
966C17721F0439F600D3E83C
/* Material+MotionAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+MotionAnimation.swift"
;
sourceTree
=
"<group>"
;
};
966C17721F0439F600D3E83C
/* Material+MotionAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+MotionAnimation.swift"
;
sourceTree
=
"<group>"
;
};
966ECF291CF4C20100BB0BDF
/* CollectionReusableView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CollectionReusableView.swift
;
sourceTree
=
"<group>"
;
};
966ECF291CF4C20100BB0BDF
/* CollectionReusableView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CollectionReusableView.swift
;
sourceTree
=
"<group>"
;
};
967A48181D0F425A00B8CEB7
/* StatusBarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
StatusBarController.swift
;
sourceTree
=
"<group>"
;
};
967A48181D0F425A00B8CEB7
/* StatusBarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
StatusBarController.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -784,6 +786,7 @@
...
@@ -784,6 +786,7 @@
96C1C8801D42C62800E6608F
/* Material+Array.swift */
,
96C1C8801D42C62800E6608F
/* Material+Array.swift */
,
962864591D53FE3E00690B69
/* Material+UIWindow.swift */
,
962864591D53FE3E00690B69
/* Material+UIWindow.swift */
,
966C17721F0439F600D3E83C
/* Material+MotionAnimation.swift */
,
966C17721F0439F600D3E83C
/* Material+MotionAnimation.swift */
,
9667A2481F33D5E200C45078
/* Material+UIViewController.swift */
,
);
);
name
=
Extension
;
name
=
Extension
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -1009,6 +1012,7 @@
...
@@ -1009,6 +1012,7 @@
965E81031DD4D5C800D61E4B
/* CollectionView.swift in Sources */
,
965E81031DD4D5C800D61E4B
/* CollectionView.swift in Sources */
,
965E81041DD4D5C800D61E4B
/* CollectionViewCell.swift in Sources */
,
965E81041DD4D5C800D61E4B
/* CollectionViewCell.swift in Sources */
,
96A180941F2E2B6E006BD69D
/* MotionCAAnimation.swift in Sources */
,
96A180941F2E2B6E006BD69D
/* MotionCAAnimation.swift in Sources */
,
9667A2491F33D5E200C45078
/* Material+UIViewController.swift in Sources */
,
965E81071DD4D5C800D61E4B
/* CollectionViewLayout.swift in Sources */
,
965E81071DD4D5C800D61E4B
/* CollectionViewLayout.swift in Sources */
,
96A180A41F2E2B6E006BD69D
/* TransitionPreprocessor.swift in Sources */
,
96A180A41F2E2B6E006BD69D
/* TransitionPreprocessor.swift in Sources */
,
965E81081DD4D5C800D61E4B
/* CollectionReusableView.swift in Sources */
,
965E81081DD4D5C800D61E4B
/* CollectionReusableView.swift in Sources */
,
...
...
Sources/Info.plist
View file @
dc110fd1
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
2.
8.1
<
/string
>
<
string
>
2.
9.0
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
Sources/iOS/FABMenuController.swift
View file @
dc110fd1
...
@@ -43,14 +43,7 @@ extension UIViewController {
...
@@ -43,14 +43,7 @@ extension UIViewController {
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
fabMenuController
:
FABMenuController
?
{
public
var
fabMenuController
:
FABMenuController
?
{
var
viewController
:
UIViewController
?
=
self
return
findViewControllerType
()
while
nil
!=
viewController
{
if
viewController
is
FABMenuController
{
return
viewController
as?
FABMenuController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
}
}
...
...
Sources/iOS/Material+UIViewController.swift
0 → 100644
View file @
dc110fd1
/*
* Copyright (C) 2015 - 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
internal
extension
UIViewController
{
/**
Finds a view controller with a given type based on
the view controller subclass.
- Returns: An optional of type T.
*/
func
findViewControllerType
<
T
:
UIViewController
>
()
->
T
?
{
var
v
:
UIViewController
?
=
self
while
nil
!=
v
{
if
v
is
T
{
return
v
as?
T
}
v
=
v
?
.
parent
}
return
nil
}
}
Sources/iOS/NavigationDrawerController.swift
View file @
dc110fd1
...
@@ -38,19 +38,12 @@ public enum NavigationDrawerPosition: Int {
...
@@ -38,19 +38,12 @@ public enum NavigationDrawerPosition: Int {
extension
UIViewController
{
extension
UIViewController
{
/**
/**
A convenience property that provides access to the NavigationDrawerController.
A convenience property that provides access to the NavigationDrawerController.
This is the recommended method of accessing the NavigationDrawerController
This is the recommended method of accessing the NavigationDrawerController
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
navigationDrawerController
:
NavigationDrawerController
?
{
public
var
navigationDrawerController
:
NavigationDrawerController
?
{
var
viewController
:
UIViewController
?
=
self
return
findViewControllerType
()
while
nil
!=
viewController
{
if
viewController
is
NavigationDrawerController
{
return
viewController
as?
NavigationDrawerController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
}
}
...
...
Sources/iOS/SearchBarController.swift
View file @
dc110fd1
...
@@ -30,22 +30,15 @@
...
@@ -30,22 +30,15 @@
import
UIKit
import
UIKit
extension
UIViewController
{
public
extension
UIViewController
{
/**
/**
A convenience property that provides access to the SearchBarController.
A convenience property that provides access to the SearchBarController.
This is the recommended method of accessing the SearchBarController
This is the recommended method of accessing the SearchBarController
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
searchBarController
:
SearchBarController
?
{
var
searchBarController
:
SearchBarController
?
{
var
viewController
:
UIViewController
?
=
self
return
findViewControllerType
()
while
nil
!=
viewController
{
}
if
viewController
is
SearchBarController
{
return
viewController
as?
SearchBarController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
}
open
class
SearchBarController
:
StatusBarController
{
open
class
SearchBarController
:
StatusBarController
{
...
...
Sources/iOS/SnackbarController.swift
View file @
dc110fd1
...
@@ -78,14 +78,7 @@ extension UIViewController {
...
@@ -78,14 +78,7 @@ extension UIViewController {
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
snackbarController
:
SnackbarController
?
{
public
var
snackbarController
:
SnackbarController
?
{
var
viewController
:
UIViewController
?
=
self
return
findViewControllerType
()
while
nil
!=
viewController
{
if
viewController
is
SnackbarController
{
return
viewController
as?
SnackbarController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
}
}
...
...
Sources/iOS/StatusBarController.swift
View file @
dc110fd1
...
@@ -37,14 +37,7 @@ extension UIViewController {
...
@@ -37,14 +37,7 @@ extension UIViewController {
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
statusBarController
:
StatusBarController
?
{
public
var
statusBarController
:
StatusBarController
?
{
var
viewController
:
UIViewController
?
=
self
return
findViewControllerType
()
while
nil
!=
viewController
{
if
viewController
is
StatusBarController
{
return
viewController
as?
StatusBarController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
}
}
...
...
Sources/iOS/TabsController.swift
View file @
dc110fd1
...
@@ -60,14 +60,7 @@ extension UIViewController {
...
@@ -60,14 +60,7 @@ extension UIViewController {
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
tabsController
:
TabsController
?
{
public
var
tabsController
:
TabsController
?
{
var
viewController
:
UIViewController
?
=
self
return
findViewControllerType
()
while
nil
!=
viewController
{
if
viewController
is
TabsController
{
return
viewController
as?
TabsController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
}
}
...
...
Sources/iOS/ToolbarController.swift
View file @
dc110fd1
...
@@ -30,22 +30,15 @@
...
@@ -30,22 +30,15 @@
import
UIKit
import
UIKit
extension
UIViewController
{
public
extension
UIViewController
{
/**
/**
A convenience property that provides access to the ToolbarController.
A convenience property that provides access to the ToolbarController.
This is the recommended method of accessing the ToolbarController
This is the recommended method of accessing the ToolbarController
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
toolbarController
:
ToolbarController
?
{
var
toolbarController
:
ToolbarController
?
{
var
viewController
:
UIViewController
?
=
self
return
findViewControllerType
()
while
nil
!=
viewController
{
}
if
viewController
is
ToolbarController
{
return
viewController
as?
ToolbarController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
}
@objc(ToolbarController)
@objc(ToolbarController)
...
...
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