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
3386efad
Unverified
Commit
3386efad
authored
Oct 10, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: Color is now a subclass of UIColor
parent
6840f013
Hide whitespace changes
Inline
Side-by-side
Showing
86 changed files
with
408 additions
and
389 deletions
+408
-389
Examples/Programmatic/Bar/Bar/ViewController.swift
+6
-6
Examples/Programmatic/BottomNavigationController/BottomNavigationController/AppBottomNavigationController.swift
+1
-1
Examples/Programmatic/BottomNavigationController/BottomNavigationController/AudioViewController.swift
+3
-3
Examples/Programmatic/BottomNavigationController/BottomNavigationController/PhotoViewController.swift
+3
-3
Examples/Programmatic/BottomNavigationController/BottomNavigationController/RemindersViewController.swift
+3
-3
Examples/Programmatic/BottomNavigationController/BottomNavigationController/SearchViewController.swift
+3
-3
Examples/Programmatic/BottomNavigationController/BottomNavigationController/VideoViewController.swift
+3
-3
Examples/Programmatic/Button/Button/ViewController.swift
+4
-4
Examples/Programmatic/CaptureController/CaptureController/AppCaptureController.swift
+4
-4
Examples/Programmatic/CaptureController/CaptureController/ViewController.swift
+17
-17
Examples/Programmatic/Card/Card/ViewController.swift
+5
-5
Examples/Programmatic/ImageCard/ImageCard/ViewController.swift
+7
-7
Examples/Programmatic/Layer/Layer/ViewController.swift
+2
-2
Examples/Programmatic/MenuController/MenuController/AppMenuController.swift
+1
-1
Examples/Programmatic/MenuController/MenuController/RootViewController.swift
+4
-4
Examples/Programmatic/NavigationController/NavigationController/AppNavigationController.swift
+1
-1
Examples/Programmatic/NavigationController/NavigationController/NextViewController.swift
+4
-4
Examples/Programmatic/NavigationController/NavigationController/RootViewController.swift
+6
-6
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/LeftViewController.swift
+2
-2
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RightViewController.swift
+2
-2
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RootViewController.swift
+1
-1
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/TransitionedViewController.swift
+1
-1
Examples/Programmatic/PageTabBarController/PageTabBarController/AppPageTabBarController.swift
+2
-2
Examples/Programmatic/PageTabBarController/PageTabBarController/BlueViewController.swift
+2
-2
Examples/Programmatic/PageTabBarController/PageTabBarController/GreenViewController.swift
+2
-2
Examples/Programmatic/PageTabBarController/PageTabBarController/RedViewController.swift
+2
-2
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/AppToolbarController.swift
+1
-1
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/PhotoLibraryCollectionViewCell.swift
+1
-1
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/PhotoLibraryViewController.swift
+2
-2
Examples/Programmatic/PresenterCard/PresenterCard/ViewController.swift
+6
-6
Examples/Programmatic/SearchBarController/SearchBarController/RootViewController.swift
+1
-1
Examples/Programmatic/SnackbarController/SnackbarController/RootViewController.swift
+2
-2
Examples/Programmatic/StatusBarController/StatusBarController/RootViewController.swift
+1
-1
Examples/Programmatic/Switch/Switch/ViewController.swift
+1
-1
Examples/Programmatic/TabBar/TabBar/ViewController.swift
+7
-7
Examples/Programmatic/TextField/TextField/ViewController.swift
+6
-6
Examples/Programmatic/ToolbarController/ToolbarController/RootViewController.swift
+1
-1
Examples/Programmatic/View/View/ViewController.swift
+2
-2
Examples/Storyboards/BottomNavigationController/BottomNavigationController/AppBottomNavigationController.swift
+1
-1
Examples/Storyboards/BottomNavigationController/BottomNavigationController/AudioViewController.swift
+3
-3
Examples/Storyboards/BottomNavigationController/BottomNavigationController/PhotoViewController.swift
+3
-3
Examples/Storyboards/BottomNavigationController/BottomNavigationController/RemindersViewController.swift
+3
-3
Examples/Storyboards/BottomNavigationController/BottomNavigationController/SearchViewController.swift
+3
-3
Examples/Storyboards/BottomNavigationController/BottomNavigationController/VideoViewController.swift
+3
-3
Examples/Storyboards/Button/Button/ViewController.swift
+1
-1
Examples/Storyboards/NavigationController/NavigationController/NextViewController.swift
+2
-2
Examples/Storyboards/NavigationController/NavigationController/RootViewController.swift
+1
-1
Examples/Storyboards/NavigationDrawerController/NavigationDrawerController/LeftViewController.swift
+1
-1
Examples/Storyboards/NavigationDrawerController/NavigationDrawerController/RightViewController.swift
+1
-1
Examples/Storyboards/PageTabBarController/PageTabBarController/AppPageTabBarController.swift
+1
-1
Examples/Storyboards/PageTabBarController/PageTabBarController/BlueViewController.swift
+2
-2
Examples/Storyboards/PageTabBarController/PageTabBarController/GreenViewController.swift
+2
-2
Examples/Storyboards/PageTabBarController/PageTabBarController/RedViewController.swift
+2
-2
Examples/Storyboards/SearchBarController/SearchBarController/RootViewController.swift
+1
-1
Examples/Storyboards/SnackbarController/SnackbarController/RootViewController.swift
+2
-2
Examples/Storyboards/StatusBarController/StatusBarController/RootViewController.swift
+1
-1
Sources/iOS/BottomNavigationController.swift
+1
-1
Sources/iOS/BottomTabBar.swift
+3
-3
Sources/iOS/Button.swift
+9
-9
Sources/iOS/Capture.swift
+100
-62
Sources/iOS/CaptureController.swift
+35
-46
Sources/iOS/CaptureSession.swift
+36
-36
Sources/iOS/CollectionReusableView.swift
+2
-2
Sources/iOS/CollectionView.swift
+5
-4
Sources/iOS/CollectionViewCell.swift
+2
-2
Sources/iOS/Color.swift
+9
-18
Sources/iOS/Divider.swift
+1
-1
Sources/iOS/FabButton.swift
+2
-2
Sources/iOS/Material+CALayer.swift
+1
-1
Sources/iOS/Material+UIImage.swift
+2
-2
Sources/iOS/Material+UIView.swift
+1
-1
Sources/iOS/MenuItem.swift
+1
-1
Sources/iOS/NavigationBar.swift
+4
-4
Sources/iOS/NavigationController.swift
+1
-1
Sources/iOS/NavigationDrawerController.swift
+1
-1
Sources/iOS/PhotoLibraryController.swift
+1
-1
Sources/iOS/Pulse.swift
+1
-1
Sources/iOS/RaisedButton.swift
+1
-1
Sources/iOS/RootController.swift
+1
-1
Sources/iOS/SearchBar.swift
+3
-3
Sources/iOS/Switch.swift
+11
-11
Sources/iOS/TableViewCell.swift
+1
-1
Sources/iOS/TextField.swift
+3
-3
Sources/iOS/TextView.swift
+3
-3
Sources/iOS/View.swift
+1
-1
Sources/macOS/Color.swift
+11
-11
No files found.
Examples/Programmatic/Bar/Bar/ViewController.swift
View file @
3386efad
...
...
@@ -47,7 +47,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
.
white
prepareMenuButton
()
prepareFavoriteButton
()
...
...
@@ -56,23 +56,23 @@ class ViewController: UIViewController {
}
private
func
prepareMenuButton
()
{
menuButton
=
IconButton
(
image
:
Icon
.
cm
.
menu
,
tintColor
:
Color
.
white
)
menuButton
=
IconButton
(
image
:
Icon
.
cm
.
menu
,
tintColor
:
.
white
)
}
private
func
prepareFavoriteButton
()
{
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
white
)
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
.
white
)
}
private
func
prepareShareButton
()
{
shareButton
=
IconButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
Color
.
white
)
shareButton
=
IconButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
.
white
)
}
private
func
prepareBar
()
{
bar
=
Bar
(
leftViews
:
[
menuButton
],
rightViews
:
[
favoriteButton
,
shareButton
])
bar
.
backgroundColor
=
Color
.
blue
.
base
bar
.
backgroundColor
=
.
blue
.
base
bar
.
contentView
.
cornerRadiusPreset
=
.
cornerRadius1
bar
.
contentView
.
backgroundColor
=
Color
.
blue
.
lighten3
bar
.
contentView
.
backgroundColor
=
.
blue
.
lighten3
view
.
layout
(
bar
)
.
horizontally
()
.
center
()
}
...
...
Examples/Programmatic/BottomNavigationController/BottomNavigationController/AppBottomNavigationController.swift
View file @
3386efad
...
...
@@ -39,6 +39,6 @@ class AppBottomNavigationController: BottomNavigationController {
private
func
prepareTabBar
()
{
tabBar
.
depthPreset
=
.
none
tabBar
.
dividerColor
=
Color
.
grey
.
lighten3
tabBar
.
dividerColor
=
.
grey
.
lighten3
}
}
Examples/Programmatic/BottomNavigationController/BottomNavigationController/AudioViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class AudioViewController: UIViewController {
/// Prepare tabBarItem.
private
func
prepareTabBarItem
()
{
tabBarItem
.
image
=
Icon
.
cm
.
audioLibrary
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
audioLibrary
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
audioLibrary
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
audioLibrary
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
.
blue
.
base
}
}
Examples/Programmatic/BottomNavigationController/BottomNavigationController/PhotoViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class PhotoViewController: UIViewController {
/// Prepare tabBarItem.
private
func
prepareTabBarItem
()
{
tabBarItem
.
image
=
Icon
.
cm
.
photoCamera
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
photoCamera
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
photoCamera
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
photoCamera
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
red
.
base
view
.
backgroundColor
=
.
red
.
base
}
}
Examples/Programmatic/BottomNavigationController/BottomNavigationController/RemindersViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class RemindersViewController: UIViewController {
/// Prepare tabBarItem.
private
func
prepareTabBarItem
()
{
tabBarItem
.
image
=
Icon
.
cm
.
bell
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
bell
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
bell
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
bell
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
yellow
.
base
view
.
backgroundColor
=
.
yellow
.
base
}
}
Examples/Programmatic/BottomNavigationController/BottomNavigationController/SearchViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class SearchViewController: UIViewController {
/// Prepare tabBarItem.
private
func
prepareTabBarItem
()
{
tabBarItem
.
image
=
Icon
.
cm
.
search
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
search
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
search
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
search
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blueGrey
.
base
view
.
backgroundColor
=
.
blueGrey
.
base
}
}
Examples/Programmatic/BottomNavigationController/BottomNavigationController/VideoViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class VideoViewController: UIViewController {
/// Prepare tabBarItem.
private
func
prepareTabBarItem
()
{
tabBarItem
.
image
=
Icon
.
cm
.
videocam
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
videocam
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
videocam
?
.
tint
(
with
:
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
videocam
?
.
tint
(
with
:
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
green
.
base
view
.
backgroundColor
=
green
.
base
}
}
Examples/Programmatic/Button/Button/ViewController.swift
View file @
3386efad
...
...
@@ -58,7 +58,7 @@ struct ButtonLayout {
class
ViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareFlatButton
()
prepareRaisedButton
()
...
...
@@ -76,8 +76,8 @@ class ViewController: UIViewController {
}
private
func
prepareRaisedButton
()
{
let
button
=
RaisedButton
(
title
:
"Raised Button"
,
titleColor
:
Color
.
white
)
button
.
backgroundColor
=
Color
.
blue
.
base
let
button
=
RaisedButton
(
title
:
"Raised Button"
,
titleColor
:
white
)
button
.
backgroundColor
=
blue
.
base
view
.
layout
(
button
)
.
width
(
ButtonLayout
.
Raised
.
width
)
...
...
@@ -86,7 +86,7 @@ class ViewController: UIViewController {
}
private
func
prepareFabButton
()
{
let
button
=
FabButton
(
image
:
Icon
.
cm
.
add
,
tintColor
:
Color
.
white
)
let
button
=
FabButton
(
image
:
Icon
.
cm
.
add
,
tintColor
:
white
)
view
.
layout
(
button
)
.
width
(
ButtonLayout
.
Fab
.
diameter
)
...
...
Examples/Programmatic/CaptureController/CaptureController/AppCaptureController.swift
View file @
3386efad
...
...
@@ -42,11 +42,11 @@ class AppCaptureController: CaptureController {
private
func
prepareToolbar
()
{
toolbar
.
titleLabel
.
isHidden
=
true
toolbar
.
titleLabel
.
textColor
=
Color
.
white
toolbar
.
titleLabel
.
textColor
=
white
toolbar
.
detailLabel
.
isHidden
=
true
toolbar
.
detail
=
"Recording"
toolbar
.
detailLabel
.
textColor
=
Color
.
red
.
accent1
toolbar
.
detailLabel
.
textColor
=
red
.
accent1
toolbar
.
leftViews
=
[
switchCamerasButton
]
toolbar
.
rightViews
=
[
flashButton
]
...
...
@@ -55,8 +55,8 @@ class AppCaptureController: CaptureController {
private
func
prepareCaptureButton
()
{
captureButton
.
width
=
72
captureButton
.
height
=
72
captureButton
.
backgroundColor
=
Color
.
red
.
darken1
.
withAlphaComponent
(
0.3
)
captureButton
.
borderColor
=
Color
.
white
captureButton
.
backgroundColor
=
red
.
darken1
.
withAlphaComponent
(
0.3
)
captureButton
.
borderColor
=
white
captureButton
.
borderWidthPreset
=
.
border3
captureButton
.
depthPreset
=
.
none
}
...
...
Examples/Programmatic/CaptureController/CaptureController/ViewController.swift
View file @
3386efad
...
...
@@ -44,26 +44,26 @@ class ViewController: UIViewController {
}
cc
.
capture
.
delegate
=
self
cc
.
capture
.
captureS
ession
.
delegate
=
self
cc
.
capture
.
s
ession
.
delegate
=
self
view
.
layout
(
cc
.
capture
)
.
edges
()
}
}
/// CaptureSessionDelegate.
extension
ViewController
:
CaptureSessionDelegate
{
public
func
captureSessionFailedWithError
(
captureS
ession
:
CaptureSession
,
error
:
Error
)
{
public
func
sessionFailedWithError
(
s
ession
:
CaptureSession
,
error
:
Error
)
{
print
(
error
)
}
public
func
captureSessionStillImageAsynchronously
(
captureS
ession
:
CaptureSession
,
image
:
UIImage
)
{
public
func
sessionStillImageAsynchronously
(
s
ession
:
CaptureSession
,
image
:
UIImage
)
{
print
(
"captureStillImageAsynchronously"
)
}
public
func
captureSessionCreateMovieFileFailedWithError
(
captureS
ession
:
CaptureSession
,
error
:
Error
)
{
public
func
sessionCreateMovieFileFailedWithError
(
s
ession
:
CaptureSession
,
error
:
Error
)
{
print
(
"Capture Failed
\(
error
)
"
)
}
public
func
captureSessionDidStartRecordingToOutputFileAtURL
(
captureS
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
fileURL
:
NSURL
,
fromConnections
connections
:
[
Any
])
{
public
func
sessionDidStartRecordingToOutputFileAtURL
(
s
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
fileURL
:
NSURL
,
fromConnections
connections
:
[
Any
])
{
print
(
"Capture Started Recording
\(
fileURL
)
"
)
// cameraButton.isHidden = true
// videoButton.isHidden = true
...
...
@@ -71,7 +71,7 @@ extension ViewController: CaptureSessionDelegate {
// flashButton.isHidden = true
}
public
func
captureSessionDidFinishRecordingToOutputFileAtURL
(
captureS
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
outputFileURL
:
NSURL
,
fromConnections
connections
:
[
Any
],
error
:
Error
!
)
{
public
func
sessionDidFinishRecordingToOutputFileAtURL
(
s
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
outputFileURL
:
NSURL
,
fromConnections
connections
:
[
Any
],
error
:
Error
!
)
{
print
(
"Capture Stopped Recording
\(
outputFileURL
)
"
)
// cameraButton.isHidden = false
// videoButton.isHidden = false
...
...
@@ -94,17 +94,17 @@ extension ViewController: CaptureSessionDelegate {
// toolbar.detailLabel.isHidden = true
}
public
func
captureSessionWillSwitchCameras
(
captureS
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
{
public
func
sessionWillSwitchCameras
(
s
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
{
// ... do something
}
public
func
captureSessionDidSwitchCameras
(
captureS
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
{
public
func
sessionDidSwitchCameras
(
s
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
{
// if .back == position {
// capture.
captureS
ession.flashMode = .auto
// capture.
s
ession.flashMode = .auto
// flashButton.image = UIImage(named: "ic_flash_auto_white")
// switchCamerasButton.image = UIImage(named: "ic_camera_front_white")
// } else {
// capture.
captureS
ession.flashMode = .off
// capture.
s
ession.flashMode = .off
// flashButton.image = UIImage(named: "ic_flash_off_white")
// switchCamerasButton.image = UIImage(named: "ic_camera_rear_white")
// }
...
...
@@ -114,7 +114,7 @@ extension ViewController: CaptureSessionDelegate {
/// CaptureDelegate.
extension
ViewController
:
CaptureDelegate
{
public
func
captureDidPressFlashButton
(
capture
:
Capture
,
button
:
UIButton
)
{
// guard .back == capture.
captureS
ession.position else {
// guard .back == capture.
s
ession.position else {
// return
// }
//
...
...
@@ -122,25 +122,25 @@ extension ViewController: CaptureDelegate {
// return
// }
//
// switch capture.
captureS
ession.flashMode {
// switch capture.
s
ession.flashMode {
// case .off:
// b.image = UIImage(named: "ic_flash_on_white")
// capture.
captureS
ession.flashMode = .on
// capture.
s
ession.flashMode = .on
// case .on:
// b.image = UIImage(named: "ic_flash_auto_white")
// capture.
captureS
ession.flashMode = .auto
// capture.
s
ession.flashMode = .auto
// case .auto:
// b.image = UIImage(named: "ic_flash_off_white")
// capture.
captureS
ession.flashMode = .off
// capture.
s
ession.flashMode = .off
// }
}
public
func
captureDidPressCameraButton
(
capture
:
Capture
,
button
:
UIButton
)
{
// captureButton.backgroundColor =
Color.
blue.darken1.withAlphaComponent(0.3)
// captureButton.backgroundColor = blue.darken1.withAlphaComponent(0.3)
}
public
func
captureDidPressVideoButton
(
capture
:
Capture
,
button
:
UIButton
)
{
// captureButton.backgroundColor =
Color.
red.darken1.withAlphaComponent(0.3)
// captureButton.backgroundColor = red.darken1.withAlphaComponent(0.3)
}
public
func
captureDidPressCaptureButton
(
capture
:
Capture
,
button
:
UIButton
)
{
...
...
Examples/Programmatic/Card/Card/ViewController.swift
View file @
3386efad
...
...
@@ -50,7 +50,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
prepareDateFormatter
()
prepareDateLabel
()
...
...
@@ -71,16 +71,16 @@ class ViewController: UIViewController {
private
func
prepareDateLabel
()
{
dateLabel
=
UILabel
()
dateLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
dateLabel
.
textColor
=
Color
.
blueGrey
.
base
dateLabel
.
textColor
=
blueGrey
.
base
dateLabel
.
text
=
dateFormatter
.
string
(
from
:
Date
.
distantFuture
)
}
private
func
prepareFavoriteButton
()
{
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
red
.
base
)
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
red
.
base
)
}
private
func
prepareMoreButton
()
{
moreButton
=
IconButton
(
image
:
Icon
.
cm
.
moreVertical
,
tintColor
:
Color
.
blueGrey
.
base
)
moreButton
=
IconButton
(
image
:
Icon
.
cm
.
moreVertical
,
tintColor
:
blueGrey
.
base
)
}
private
func
prepareAuthorView
()
{
...
...
@@ -97,7 +97,7 @@ class ViewController: UIViewController {
toolbar
.
detail
=
"Build Beautiful Software"
toolbar
.
detailLabel
.
textAlignment
=
.
left
toolbar
.
detailLabel
.
textColor
=
Color
.
blueGrey
.
base
toolbar
.
detailLabel
.
textColor
=
blueGrey
.
base
}
private
func
prepareContentView
()
{
...
...
Examples/Programmatic/ImageCard/ImageCard/ViewController.swift
View file @
3386efad
...
...
@@ -50,7 +50,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
prepareImageView
()
prepareFavoriteButton
()
...
...
@@ -70,19 +70,19 @@ class ViewController: UIViewController {
}
private
func
prepareFavoriteButton
()
{
favoriteButton
=
FlatButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
blueGrey
.
base
)
favoriteButton
=
FlatButton
(
image
:
Icon
.
favorite
,
tintColor
:
blueGrey
.
base
)
}
private
func
prepareShareButton
()
{
shareButton
=
FlatButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
Color
.
blueGrey
.
base
)
shareButton
=
FlatButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
blueGrey
.
base
)
}
private
func
prepareStarButton
()
{
starButton
=
FlatButton
(
image
:
Icon
.
cm
.
star
,
tintColor
:
Color
.
blueGrey
.
base
)
starButton
=
FlatButton
(
image
:
Icon
.
cm
.
star
,
tintColor
:
blueGrey
.
base
)
}
private
func
prepareMoreButton
()
{
moreButton
=
IconButton
(
image
:
Icon
.
cm
.
moreHorizontal
,
tintColor
:
Color
.
white
)
moreButton
=
IconButton
(
image
:
Icon
.
cm
.
moreHorizontal
,
tintColor
:
white
)
}
private
func
prepareToolbar
()
{
...
...
@@ -90,10 +90,10 @@ class ViewController: UIViewController {
toolbar
.
backgroundColor
=
nil
toolbar
.
title
=
"CosmicMind"
toolbar
.
titleLabel
.
textColor
=
Color
.
white
toolbar
.
titleLabel
.
textColor
=
white
toolbar
.
detail
=
"Build Beautiful Software"
toolbar
.
detailLabel
.
textColor
=
Color
.
white
toolbar
.
detailLabel
.
textColor
=
white
}
private
func
prepareContentView
()
{
...
...
Examples/Programmatic/Layer/Layer/ViewController.swift
View file @
3386efad
...
...
@@ -37,7 +37,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareLayer
()
}
...
...
@@ -50,7 +50,7 @@ class ViewController: UIViewController {
layer
=
Layer
(
frame
:
CGRect
(
x
:
(
w
-
d
)
/
2
,
y
:
(
h
-
d
)
/
2
,
width
:
d
,
height
:
d
))
layer
.
depthPreset
=
.
depth3
layer
.
shapePreset
=
.
circle
layer
.
backgroundColor
=
Color
.
white
.
cgColor
layer
.
backgroundColor
=
white
.
cgColor
layer
.
image
=
UIImage
(
named
:
"CosmicMind"
)
view
.
layer
.
addSublayer
(
layer
)
...
...
Examples/Programmatic/MenuController/MenuController/AppMenuController.swift
View file @
3386efad
...
...
@@ -38,7 +38,7 @@ class AppMenuController: MenuController {
open
override
func
prepare
()
{
super
.
prepare
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
prepareMenu
()
}
...
...
Examples/Programmatic/MenuController/MenuController/RootViewController.swift
View file @
3386efad
...
...
@@ -38,7 +38,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
prepareAddButton
()
prepareAudioLibraryButton
()
...
...
@@ -69,14 +69,14 @@ class RootViewController: UIViewController {
}
private
func
prepareAddButton
()
{
addButton
=
FabButton
(
image
:
Icon
.
cm
.
add
,
tintColor
:
Color
.
white
)
addButton
=
FabButton
(
image
:
Icon
.
cm
.
add
,
tintColor
:
white
)
addButton
.
addTarget
(
self
,
action
:
#selector(
handleToggleMenu
)
,
for
:
.
touchUpInside
)
}
private
func
prepareAudioLibraryButton
()
{
audioLibraryMenuItem
=
MenuItem
()
audioLibraryMenuItem
.
button
.
image
=
Icon
.
cm
.
audioLibrary
audioLibraryMenuItem
.
button
.
backgroundColor
=
Color
.
green
.
base
audioLibraryMenuItem
.
button
.
backgroundColor
=
green
.
base
audioLibraryMenuItem
.
button
.
depthPreset
=
.
depth1
audioLibraryMenuItem
.
title
=
"Audio Library"
}
...
...
@@ -84,7 +84,7 @@ class RootViewController: UIViewController {
private
func
prepareBellButton
()
{
reminderMenuItem
=
MenuItem
()
reminderMenuItem
.
button
.
image
=
Icon
.
cm
.
bell
reminderMenuItem
.
button
.
backgroundColor
=
Color
.
blue
.
base
reminderMenuItem
.
button
.
backgroundColor
=
blue
.
base
reminderMenuItem
.
title
=
"Reminders"
}
...
...
Examples/Programmatic/NavigationController/NavigationController/AppNavigationController.swift
View file @
3386efad
...
...
@@ -35,7 +35,7 @@ class AppNavigationController: NavigationController {
open
override
func
prepare
()
{
super
.
prepare
()
statusBarStyle
=
.
lightContent
(
navigationBar
as?
NavigationBar
)?
.
backgroundColor
=
Color
.
blue
.
base
(
navigationBar
as?
NavigationBar
)?
.
backgroundColor
=
blue
.
base
}
}
Examples/Programmatic/NavigationController/NavigationController/NextViewController.swift
View file @
3386efad
...
...
@@ -34,19 +34,19 @@ import Material
class
NextViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareNavigationItem
()
}
private
func
prepareNavigationItem
()
{
navigationItem
.
title
=
"Title"
navigationItem
.
titleLabel
.
textColor
=
Color
.
white
navigationItem
.
titleLabel
.
textColor
=
white
navigationItem
.
detail
=
"Detail Description"
navigationItem
.
detailLabel
.
textColor
=
Color
.
lightBlue
.
lighten5
navigationItem
.
detailLabel
.
textColor
=
lightBlue
.
lighten5
navigationItem
.
backButton
.
tintColor
=
Color
.
white
navigationItem
.
backButton
.
tintColor
=
white
}
}
Examples/Programmatic/NavigationController/NavigationController/RootViewController.swift
View file @
3386efad
...
...
@@ -42,7 +42,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
prepareMenuButton
()
prepareStarButton
()
...
...
@@ -56,23 +56,23 @@ class RootViewController: UIViewController {
}
private
func
prepareMenuButton
()
{
menuButton
=
IconButton
(
image
:
Icon
.
cm
.
menu
,
tintColor
:
Color
.
white
)
menuButton
=
IconButton
(
image
:
Icon
.
cm
.
menu
,
tintColor
:
white
)
}
private
func
prepareStarButton
()
{
starButton
=
IconButton
(
image
:
Icon
.
cm
.
star
,
tintColor
:
Color
.
white
)
starButton
=
IconButton
(
image
:
Icon
.
cm
.
star
,
tintColor
:
white
)
}
private
func
prepareSearchButton
()
{
searchButton
=
IconButton
(
image
:
Icon
.
cm
.
search
,
tintColor
:
Color
.
white
)
searchButton
=
IconButton
(
image
:
Icon
.
cm
.
search
,
tintColor
:
white
)
}
private
func
prepareNavigationItem
()
{
navigationItem
.
title
=
"Material"
navigationItem
.
titleLabel
.
textColor
=
Color
.
white
navigationItem
.
titleLabel
.
textColor
=
white
navigationItem
.
detail
=
"Build Beautiful Software"
navigationItem
.
detailLabel
.
textColor
=
Color
.
lightBlue
.
lighten5
navigationItem
.
detailLabel
.
textColor
=
lightBlue
.
lighten5
navigationItem
.
leftViews
=
[
menuButton
]
navigationItem
.
rightViews
=
[
starButton
,
searchButton
]
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/LeftViewController.swift
View file @
3386efad
...
...
@@ -36,7 +36,7 @@ class LeftViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
blue
.
base
prepareTransitionButton
()
}
...
...
@@ -55,7 +55,7 @@ class LeftViewController: UIViewController {
}
private
func
prepareTransitionButton
()
{
transitionButton
=
FlatButton
(
title
:
"Transition VC"
,
titleColor
:
Color
.
white
)
transitionButton
=
FlatButton
(
title
:
"Transition VC"
,
titleColor
:
white
)
transitionButton
.
addTarget
(
self
,
action
:
#selector(
handleTransitionButton
)
,
for
:
.
touchUpInside
)
view
.
layout
(
transitionButton
)
.
horizontally
()
.
center
()
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RightViewController.swift
View file @
3386efad
...
...
@@ -36,7 +36,7 @@ class RightViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
blue
.
base
prepareRootButton
()
}
...
...
@@ -55,7 +55,7 @@ class RightViewController: UIViewController {
}
private
func
prepareRootButton
()
{
rootButton
=
FlatButton
(
title
:
"Root VC"
,
titleColor
:
Color
.
white
)
rootButton
=
FlatButton
(
title
:
"Root VC"
,
titleColor
:
white
)
rootButton
.
addTarget
(
self
,
action
:
#selector(
handleTransitionButton
)
,
for
:
.
touchUpInside
)
view
.
layout
(
rootButton
)
.
horizontally
()
.
center
()
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RootViewController.swift
View file @
3386efad
...
...
@@ -34,7 +34,7 @@ import Material
class
RootViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareToolbar
()
}
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/TransitionedViewController.swift
View file @
3386efad
...
...
@@ -34,7 +34,7 @@ import Material
class
TransitionedViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
purple
.
base
view
.
backgroundColor
=
purple
.
base
prepareToolbar
()
}
...
...
Examples/Programmatic/PageTabBarController/PageTabBarController/AppPageTabBarController.swift
View file @
3386efad
...
...
@@ -40,8 +40,8 @@ class AppPageTabBarController: PageTabBarController {
}
private
func
preparePageTabBar
()
{
pageTabBar
.
lineColor
=
Color
.
blueGrey
.
base
pageTabBar
.
dividerColor
=
Color
.
blueGrey
.
lighten5
pageTabBar
.
lineColor
=
blueGrey
.
base
pageTabBar
.
dividerColor
=
blueGrey
.
lighten5
}
}
...
...
Examples/Programmatic/PageTabBarController/PageTabBarController/BlueViewController.swift
View file @
3386efad
...
...
@@ -44,12 +44,12 @@ class BlueViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
blue
.
base
}
private
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Blue"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
pageTabBarItem
.
titleColor
=
blueGrey
.
base
}
}
Examples/Programmatic/PageTabBarController/PageTabBarController/GreenViewController.swift
View file @
3386efad
...
...
@@ -44,12 +44,12 @@ class GreenViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
green
.
base
view
.
backgroundColor
=
green
.
base
}
private
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Green"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
pageTabBarItem
.
titleColor
=
blueGrey
.
base
}
}
Examples/Programmatic/PageTabBarController/PageTabBarController/RedViewController.swift
View file @
3386efad
...
...
@@ -44,12 +44,12 @@ class RedViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
red
.
base
view
.
backgroundColor
=
red
.
base
}
private
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Red"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
pageTabBarItem
.
titleColor
=
blueGrey
.
base
}
}
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/AppToolbarController.swift
View file @
3386efad
...
...
@@ -42,6 +42,6 @@ class AppToolbarController: ToolbarController {
private
func
prepareToolbar
()
{
toolbar
.
title
=
"Photo Library"
toolbar
.
depthPreset
=
.
none
toolbar
.
dividerColor
=
Color
.
grey
.
lighten3
toolbar
.
dividerColor
=
grey
.
lighten3
}
}
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/PhotoLibraryCollectionViewCell.swift
View file @
3386efad
...
...
@@ -50,7 +50,7 @@ class PhotoLibraryCollectionReusableView: CollectionReusableView {
toolbar
.
contentEdgeInsets
.
left
=
16
toolbar
.
contentEdgeInsets
.
right
=
16
toolbar
.
depthPreset
=
.
none
toolbar
.
dividerColor
=
Color
.
grey
.
lighten3
toolbar
.
dividerColor
=
grey
.
lighten3
layout
(
toolbar
)
.
edges
()
}
}
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/PhotoLibraryViewController.swift
View file @
3386efad
...
...
@@ -73,7 +73,7 @@ class PhotoLibraryViewController: PhotoLibraryController {
open
override
func
prepare
()
{
super
.
prepare
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
prepareCollectionView
()
...
...
@@ -141,7 +141,7 @@ class PhotoLibraryViewController: PhotoLibraryController {
layout
.
sectionHeadersPinToVisibleBounds
=
true
collectionView
=
PhotoLibraryCollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
layout
)
collectionView
.
backgroundColor
=
Color
.
clear
collectionView
.
backgroundColor
=
clear
collectionView
.
delegate
=
self
collectionView
.
dataSource
=
self
view
.
layout
(
collectionView
)
.
edges
()
...
...
Examples/Programmatic/PresenterCard/PresenterCard/ViewController.swift
View file @
3386efad
...
...
@@ -51,7 +51,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
preparePresenterView
()
prepareDateFormatter
()
...
...
@@ -79,21 +79,21 @@ class ViewController: UIViewController {
private
func
prepareDateLabel
()
{
dateLabel
=
UILabel
()
dateLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
dateLabel
.
textColor
=
Color
.
blueGrey
.
base
dateLabel
.
textColor
=
blueGrey
.
base
dateLabel
.
textAlignment
=
.
center
dateLabel
.
text
=
dateFormatter
.
string
(
from
:
Date
.
distantFuture
)
}
private
func
prepareFavoriteButton
()
{
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
red
.
base
)
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
red
.
base
)
}
private
func
prepareShareButton
()
{
shareButton
=
IconButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
Color
.
blueGrey
.
base
)
shareButton
=
IconButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
blueGrey
.
base
)
}
private
func
prepareMoreButton
()
{
moreButton
=
IconButton
(
image
:
Icon
.
cm
.
moreHorizontal
,
tintColor
:
Color
.
blueGrey
.
base
)
moreButton
=
IconButton
(
image
:
Icon
.
cm
.
moreHorizontal
,
tintColor
:
blueGrey
.
base
)
}
private
func
prepareToolbar
()
{
...
...
@@ -104,7 +104,7 @@ class ViewController: UIViewController {
toolbar
.
detail
=
"Build Beautiful Software"
toolbar
.
detailLabel
.
textAlignment
=
.
left
toolbar
.
detailLabel
.
textColor
=
Color
.
blueGrey
.
base
toolbar
.
detailLabel
.
textColor
=
blueGrey
.
base
}
private
func
prepareContentView
()
{
...
...
Examples/Programmatic/SearchBarController/SearchBarController/RootViewController.swift
View file @
3386efad
...
...
@@ -37,7 +37,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
view
.
backgroundColor
=
grey
.
lighten1
}
open
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
...
...
Examples/Programmatic/SnackbarController/SnackbarController/RootViewController.swift
View file @
3386efad
...
...
@@ -36,7 +36,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
}
open
override
func
viewDidAppear
(
_
animated
:
Bool
)
{
...
...
@@ -49,7 +49,7 @@ class RootViewController: UIViewController {
}
private
func
prepareUndoButton
()
{
undoButton
=
FlatButton
(
title
:
"Undo"
,
titleColor
:
Color
.
yellow
.
base
)
undoButton
=
FlatButton
(
title
:
"Undo"
,
titleColor
:
yellow
.
base
)
undoButton
.
pulseAnimation
=
.
backing
undoButton
.
titleLabel
?
.
font
=
snackbarController
?
.
snackbar
.
textLabel
.
font
}
...
...
Examples/Programmatic/StatusBarController/StatusBarController/RootViewController.swift
View file @
3386efad
...
...
@@ -34,7 +34,7 @@ import Material
class
RootViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
view
.
backgroundColor
=
grey
.
lighten1
}
}
Examples/Programmatic/Switch/Switch/ViewController.swift
View file @
3386efad
...
...
@@ -35,7 +35,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareSwitch
()
}
...
...
Examples/Programmatic/TabBar/TabBar/ViewController.swift
View file @
3386efad
...
...
@@ -40,22 +40,22 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareButtons
()
prepareTabBar
()
}
private
func
prepareButtons
()
{
let
btn1
=
FlatButton
(
title
:
"Library"
,
titleColor
:
Color
.
blueGrey
.
base
)
let
btn1
=
FlatButton
(
title
:
"Library"
,
titleColor
:
blueGrey
.
base
)
btn1
.
pulseAnimation
=
.
none
buttons
.
append
(
btn1
)
let
btn2
=
FlatButton
(
title
:
"Photo"
,
titleColor
:
Color
.
blueGrey
.
base
)
let
btn2
=
FlatButton
(
title
:
"Photo"
,
titleColor
:
blueGrey
.
base
)
btn2
.
pulseAnimation
=
.
none
buttons
.
append
(
btn2
)
let
btn3
=
FlatButton
(
title
:
"Video"
,
titleColor
:
Color
.
blueGrey
.
base
)
let
btn3
=
FlatButton
(
title
:
"Video"
,
titleColor
:
blueGrey
.
base
)
btn3
.
pulseAnimation
=
.
none
buttons
.
append
(
btn3
)
}
...
...
@@ -63,13 +63,13 @@ class ViewController: UIViewController {
private
func
prepareTabBar
()
{
tabBar
=
TabBar
()
tabBar
.
dividerColor
=
Color
.
grey
.
lighten3
tabBar
.
dividerColor
=
grey
.
lighten3
tabBar
.
dividerAlignment
=
.
top
tabBar
.
lineColor
=
Color
.
blue
.
base
tabBar
.
lineColor
=
blue
.
base
tabBar
.
lineAlignment
=
.
top
tabBar
.
backgroundColor
=
Color
.
grey
.
lighten5
tabBar
.
backgroundColor
=
grey
.
lighten5
tabBar
.
buttons
=
buttons
view
.
layout
(
tabBar
)
.
horizontally
()
.
bottom
()
...
...
Examples/Programmatic/TextField/TextField/ViewController.swift
View file @
3386efad
...
...
@@ -38,7 +38,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareNameField
()
prepareEmailField
()
...
...
@@ -53,7 +53,7 @@ class ViewController: UIViewController {
/// Prepares the resign responder button.
private
func
prepareResignResponderButton
()
{
let
btn
=
RaisedButton
(
title
:
"Resign"
,
titleColor
:
Color
.
blue
.
base
)
let
btn
=
RaisedButton
(
title
:
"Resign"
,
titleColor
:
blue
.
base
)
btn
.
addTarget
(
self
,
action
:
#selector(
handleResignResponderButton(button:)
)
,
for
:
.
touchUpInside
)
view
.
layout
(
btn
)
.
width
(
100
)
.
height
(
50
)
.
bottom
(
24
)
.
right
(
24
)
...
...
@@ -87,9 +87,9 @@ class ViewController: UIViewController {
emailField
.
isClearIconButtonEnabled
=
true
emailField
.
delegate
=
self
emailField
.
placeholderNormalColor
=
Color
.
amber
.
darken4
emailField
.
placeholderActiveColor
=
Color
.
pink
.
base
emailField
.
dividerNormalColor
=
Color
.
cyan
.
base
emailField
.
placeholderNormalColor
=
amber
.
darken4
emailField
.
placeholderActiveColor
=
pink
.
base
emailField
.
dividerNormalColor
=
cyan
.
base
view
.
addSubview
(
emailField
)
}
...
...
@@ -102,7 +102,7 @@ class ViewController: UIViewController {
passwordField
.
isVisibilityIconButtonEnabled
=
true
// Setting the visibilityIconButton color.
passwordField
.
visibilityIconButton
?
.
tintColor
=
Color
.
green
.
base
.
withAlphaComponent
(
passwordField
.
isSecureTextEntry
?
0.38
:
0.54
)
passwordField
.
visibilityIconButton
?
.
tintColor
=
green
.
base
.
withAlphaComponent
(
passwordField
.
isSecureTextEntry
?
0.38
:
0.54
)
// Size the TextField to the maximum width, less 40 pixels on either side
// with a top margin of 200 pixels.
...
...
Examples/Programmatic/ToolbarController/ToolbarController/RootViewController.swift
View file @
3386efad
...
...
@@ -38,7 +38,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
}
open
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
...
...
Examples/Programmatic/View/View/ViewController.swift
View file @
3386efad
...
...
@@ -37,7 +37,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
white
prepareLogo
()
}
...
...
@@ -48,7 +48,7 @@ class ViewController: UIViewController {
logo
=
View
()
logo
.
depthPreset
=
.
depth3
logo
.
shapePreset
=
.
circle
logo
.
backgroundColor
=
Color
.
white
logo
.
backgroundColor
=
white
logo
.
image
=
UIImage
(
named
:
"CosmicMind"
)
view
.
layout
(
logo
)
.
width
(
d
)
.
height
(
d
)
.
center
()
...
...
Examples/Storyboards/BottomNavigationController/BottomNavigationController/AppBottomNavigationController.swift
View file @
3386efad
...
...
@@ -39,6 +39,6 @@ class AppBottomNavigationController: BottomNavigationController {
private
func
prepareTabBar
()
{
tabBar
.
depthPreset
=
.
none
tabBar
.
divider
.
color
=
Color
.
grey
.
lighten3
tabBar
.
divider
Color
=
.
grey
.
lighten3
}
}
Examples/Storyboards/BottomNavigationController/BottomNavigationController/AudioViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class AudioViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
.
blue
.
base
}
private
func
prepareTabBarItem
()
{
tabBarItem
.
title
=
nil
tabBarItem
.
image
=
Icon
.
cm
.
audioLibrary
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
audioLibrary
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
audioLibrary
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
audioLibrary
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
}
Examples/Storyboards/BottomNavigationController/BottomNavigationController/PhotoViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class PhotoViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
red
.
base
view
.
backgroundColor
=
.
red
.
base
}
private
func
prepareTabBarItem
()
{
tabBarItem
.
title
=
nil
tabBarItem
.
image
=
Icon
.
cm
.
photoCamera
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
photoCamera
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
photoCamera
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
photoCamera
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
}
Examples/Storyboards/BottomNavigationController/BottomNavigationController/RemindersViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class RemindersViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
yellow
.
base
view
.
backgroundColor
=
.
yellow
.
base
}
private
func
prepareTabBarItem
()
{
tabBarItem
.
title
=
nil
tabBarItem
.
image
=
Icon
.
cm
.
bell
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
bell
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
bell
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
bell
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
}
Examples/Storyboards/BottomNavigationController/BottomNavigationController/SearchViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class SearchViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blueGrey
.
base
view
.
backgroundColor
=
.
blueGrey
.
base
}
private
func
prepareTabBarItem
()
{
tabBarItem
.
title
=
nil
tabBarItem
.
image
=
Icon
.
cm
.
search
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
search
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
search
?
.
tint
(
with
:
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
search
?
.
tint
(
with
:
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
}
Examples/Storyboards/BottomNavigationController/BottomNavigationController/VideoViewController.swift
View file @
3386efad
...
...
@@ -39,12 +39,12 @@ class VideoViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
green
.
base
view
.
backgroundColor
=
green
.
base
}
private
func
prepareTabBarItem
()
{
tabBarItem
.
title
=
nil
tabBarItem
.
image
=
Icon
.
cm
.
videocam
?
.
tint
WithColor
(
color
:
Color
.
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
videocam
?
.
tint
WithColor
(
color
:
Color
.
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
image
=
Icon
.
cm
.
videocam
?
.
tint
(
with
:
blueGrey
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
tabBarItem
.
selectedImage
=
Icon
.
cm
.
videocam
?
.
tint
(
with
:
blue
.
base
)?
.
withRenderingMode
(
.
alwaysOriginal
)
}
}
Examples/Storyboards/Button/Button/ViewController.swift
View file @
3386efad
...
...
@@ -47,7 +47,7 @@ class ViewController: UIViewController {
private
func
prepareIconButton
()
{
iconButton
.
image
=
Icon
.
search
iconButton
.
pulseColor
=
Color
.
blue
.
base
iconButton
.
pulseColor
=
blue
.
base
}
}
...
...
Examples/Storyboards/NavigationController/NavigationController/NextViewController.swift
View file @
3386efad
...
...
@@ -34,7 +34,7 @@ import Material
class
NextViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
base
view
.
backgroundColor
=
grey
.
base
prepareNavigationItem
()
}
...
...
@@ -43,7 +43,7 @@ class NextViewController: UIViewController {
navigationItem
.
title
=
"Title"
navigationItem
.
detail
=
"Detail Description"
navigationItem
.
backButton
.
tintColor
=
Color
.
blue
.
base
navigationItem
.
backButton
.
tintColor
=
blue
.
base
}
}
Examples/Storyboards/NavigationController/NavigationController/RootViewController.swift
View file @
3386efad
...
...
@@ -42,7 +42,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
view
.
backgroundColor
=
grey
.
lighten1
prepareMenuButton
()
prepareStarButton
()
...
...
Examples/Storyboards/NavigationDrawerController/NavigationDrawerController/LeftViewController.swift
View file @
3386efad
...
...
@@ -34,6 +34,6 @@ import Material
class
LeftViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
blue
.
base
}
}
Examples/Storyboards/NavigationDrawerController/NavigationDrawerController/RightViewController.swift
View file @
3386efad
...
...
@@ -34,6 +34,6 @@ import Material
class
RightViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
blue
.
base
}
}
Examples/Storyboards/PageTabBarController/PageTabBarController/AppPageTabBarController.swift
View file @
3386efad
...
...
@@ -40,7 +40,7 @@ class AppPageTabBarController: PageTabBarController {
}
private
func
preparePageTabBar
()
{
pageTabBar
.
lineColor
=
Color
.
grey
.
darken1
pageTabBar
.
lineColor
=
grey
.
darken1
}
}
...
...
Examples/Storyboards/PageTabBarController/PageTabBarController/BlueViewController.swift
View file @
3386efad
...
...
@@ -44,12 +44,12 @@ class BlueViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
view
.
backgroundColor
=
blue
.
base
}
private
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Blue"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
pageTabBarItem
.
titleColor
=
blueGrey
.
base
}
}
Examples/Storyboards/PageTabBarController/PageTabBarController/GreenViewController.swift
View file @
3386efad
...
...
@@ -44,12 +44,12 @@ class GreenViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
green
.
base
view
.
backgroundColor
=
green
.
base
}
private
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Green"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
pageTabBarItem
.
titleColor
=
blueGrey
.
base
}
}
Examples/Storyboards/PageTabBarController/PageTabBarController/RedViewController.swift
View file @
3386efad
...
...
@@ -44,12 +44,12 @@ class RedViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
red
.
base
view
.
backgroundColor
=
red
.
base
}
private
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Red"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
pageTabBarItem
.
titleColor
=
blueGrey
.
base
}
}
Examples/Storyboards/SearchBarController/SearchBarController/RootViewController.swift
View file @
3386efad
...
...
@@ -37,7 +37,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
view
.
backgroundColor
=
grey
.
lighten1
}
open
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
...
...
Examples/Storyboards/SnackbarController/SnackbarController/RootViewController.swift
View file @
3386efad
...
...
@@ -36,7 +36,7 @@ class RootViewController: UIViewController {
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
}
open
override
func
viewDidAppear
(
_
animated
:
Bool
)
{
...
...
@@ -49,7 +49,7 @@ class RootViewController: UIViewController {
}
private
func
prepareUndoButton
()
{
undoButton
=
FlatButton
(
title
:
"Undo"
,
titleColor
:
Color
.
yellow
.
base
)
undoButton
=
FlatButton
(
title
:
"Undo"
,
titleColor
:
yellow
.
base
)
undoButton
.
pulseAnimation
=
.
backing
undoButton
.
titleLabel
?
.
font
=
snackbarController
?
.
snackbar
.
textLabel
.
font
}
...
...
Examples/Storyboards/StatusBarController/StatusBarController/RootViewController.swift
View file @
3386efad
...
...
@@ -34,7 +34,7 @@ import Material
class
RootViewController
:
UIViewController
{
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
view
.
backgroundColor
=
grey
.
lighten5
}
}
Sources/iOS/BottomNavigationController.swift
View file @
3386efad
...
...
@@ -160,7 +160,7 @@ open class BottomNavigationController: UITabBarController, UITabBarControllerDel
private
func
prepareTabBar
()
{
tabBar
.
depthPreset
=
.
depth1
tabBar
.
dividerAlignment
=
.
top
let
image
=
UIImage
.
image
WithColor
(
color
:
Color
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
let
image
=
UIImage
.
image
(
with
:
Color
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
tabBar
.
shadowImage
=
image
tabBar
.
backgroundImage
=
image
tabBar
.
backgroundColor
=
Color
.
white
...
...
Sources/iOS/BottomTabBar.swift
View file @
3386efad
...
...
@@ -41,7 +41,7 @@ open class BottomTabBar: UITabBar {
/// Automatically aligns the BottomNavigationBar to the superview.
open
var
isAlignedToParentAutomatically
=
true
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
didSet
{
...
...
@@ -127,8 +127,8 @@ open class BottomTabBar: UITabBar {
depthPreset
=
.
depth1
dividerAlignment
=
.
top
contentScaleFactor
=
Device
.
scale
backgroundColor
=
Color
.
white
let
image
=
UIImage
.
image
WithColor
(
color
:
Color
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
backgroundColor
=
.
white
let
image
=
UIImage
.
image
(
with
:
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
shadowImage
=
image
backgroundImage
=
image
}
...
...
Sources/iOS/Button.swift
View file @
3386efad
...
...
@@ -75,7 +75,7 @@ open class Button: UIButton {
}
}
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
didSet
{
...
...
@@ -143,9 +143,9 @@ open class Button: UIButton {
}
/**
A convenience initializer that acceps an image and tint
Color.
A convenience initializer that acceps an image and tint
- Parameter image: A UIImage.
- Parameter tintColor: A UI
Color.
- Parameter tintColor: A UI
*/
public
convenience
init
(
image
:
UIImage
?,
tintColor
:
UIColor
=
Color
.
blue
.
base
)
{
self
.
init
()
...
...
@@ -153,9 +153,9 @@ open class Button: UIButton {
}
/**
A convenience initializer that acceps a title and title
Color.
A convenience initializer that acceps a title and title
- Parameter title: A String.
- Parameter titleColor: A UI
Color.
- Parameter titleColor: A UI
*/
public
convenience
init
(
title
:
String
?,
titleColor
:
UIColor
=
Color
.
blue
.
base
)
{
self
.
init
()
...
...
@@ -252,9 +252,9 @@ open class Button: UIButton {
}
/**
Prepares the Button with an image and tint
Color.
Prepares the Button with an image and tint
- Parameter image: A UIImage.
- Parameter tintColor: A UI
Color.
- Parameter tintColor: A UI
*/
private
func
prepare
(
with
image
:
UIImage
?,
tintColor
:
UIColor
)
{
self
.
image
=
image
...
...
@@ -263,9 +263,9 @@ open class Button: UIButton {
}
/**
Prepares the Button with a title and title
Color.
Prepares the Button with a title and title
- Parameter title: A String.
- Parameter titleColor: A UI
Color.
- Parameter titleColor: A UI
*/
private
func
prepare
(
with
title
:
String
?,
titleColor
:
UIColor
)
{
self
.
title
=
title
...
...
Sources/iOS/Capture.swift
View file @
3386efad
...
...
@@ -151,10 +151,11 @@ open class Capture: View, UIGestureRecognizerDelegate {
open
lazy
var
captureMode
:
CaptureMode
=
.
video
/// A boolean indicating whether to enable tap to focus.
@IBInspectable
open
var
enableTapToFocus
=
false
{
@IBInspectable
open
var
isTapToFocusEnabled
=
false
{
didSet
{
if
enableTapToFocus
{
enableTapToReset
=
true
if
isTapToFocusEnabled
{
isTapToResetEnabled
=
true
prepareFocusLayer
()
prepareTapGesture
(
gesture
:
&
tapToFocusGesture
,
numberOfTapsRequired
:
1
,
numberOfTouchesRequired
:
1
,
selector
:
#selector(
handleTapToFocusGesture
)
)
if
let
v
:
UITapGestureRecognizer
=
tapToExposeGesture
{
...
...
@@ -169,10 +170,11 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
/// A boolean indicating whether to enable tap to expose.
@IBInspectable
open
var
enableTapToExpose
=
false
{
@IBInspectable
open
var
isTapToExposeEnabled
=
false
{
didSet
{
if
enableTapToExpose
{
enableTapToReset
=
true
if
isTapToExposeEnabled
{
isTapToResetEnabled
=
true
prepareExposureLayer
()
prepareTapGesture
(
gesture
:
&
tapToExposeGesture
,
numberOfTapsRequired
:
2
,
numberOfTouchesRequired
:
1
,
selector
:
#selector(
handleTapToExposeGesture
)
)
if
let
v
:
UITapGestureRecognizer
=
tapToFocusGesture
{
...
...
@@ -187,9 +189,10 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
/// A boolean indicating whether to enable tap to reset.
@IBInspectable
open
var
enableTapToReset
=
false
{
@IBInspectable
open
var
isTapToResetEnabled
=
false
{
didSet
{
if
enableTapToReset
{
if
isTapToResetEnabled
{
prepareResetLayer
()
prepareTapGesture
(
gesture
:
&
tapToResetGesture
,
numberOfTapsRequired
:
2
,
numberOfTouchesRequired
:
2
,
selector
:
#selector(
handleTapToResetGesture
)
)
if
let
v
:
UITapGestureRecognizer
=
tapToFocusGesture
{
...
...
@@ -207,24 +210,25 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
/// Insets preset value for content.
open
var
contentEdgeInsetsPreset
:
EdgeInsetsPreset
=
.
none
{
open
var
contentEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
didSet
{
content
Inset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
content
EdgeInsets
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
}
}
/// Content insert value.
open
var
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
.
square4
)
{
@IBInspectable
open
var
contentEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
reloadView
()
}
}
/// A reference to the CapturePreview view.
open
internal(set)
var
preview
View
:
CapturePreview
!
open
internal(set)
var
preview
:
CapturePreview
!
/// A reference to the CaptureSession.
open
internal(set)
var
captureS
ession
:
CaptureSession
!
open
internal(set)
var
s
ession
:
CaptureSession
!
/// A reference to the focus layer used in focus animations.
open
internal(set)
var
focusLayer
:
Layer
?
...
...
@@ -236,9 +240,9 @@ open class Capture: View, UIGestureRecognizerDelegate {
open
internal(set)
var
resetLayer
:
Layer
?
/// A reference to the cameraButton.
open
var
cameraButton
:
UIButton
?
{
open
var
cameraButton
:
IconButton
!
{
didSet
{
if
let
v
:
UIButton
=
cameraButton
{
if
let
v
=
cameraButton
{
v
.
addTarget
(
self
,
action
:
#selector(
handleCameraButton
)
,
for
:
.
touchUpInside
)
}
reloadView
()
...
...
@@ -246,9 +250,9 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
/// A reference to the captureButton.
open
var
captureButton
:
UIButton
?
{
open
var
captureButton
:
FabButton
!
{
didSet
{
if
let
v
:
UIButton
=
captureButton
{
if
let
v
=
captureButton
{
v
.
addTarget
(
self
,
action
:
#selector(
handleCaptureButton
)
,
for
:
.
touchUpInside
)
}
reloadView
()
...
...
@@ -257,9 +261,9 @@ open class Capture: View, UIGestureRecognizerDelegate {
/// A reference to the videoButton.
open
var
videoButton
:
UIButton
?
{
open
var
videoButton
:
IconButton
!
{
didSet
{
if
let
v
:
UIButton
=
videoButton
{
if
let
v
=
videoButton
{
v
.
addTarget
(
self
,
action
:
#selector(
handleVideoButton
)
,
for
:
.
touchUpInside
)
}
reloadView
()
...
...
@@ -267,18 +271,18 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
/// A reference to the switchCameraButton.
open
var
switchCamerasButton
:
UIButton
?
{
open
var
switchCamerasButton
:
IconButton
!
{
didSet
{
if
let
v
:
UIButton
=
switchCamerasButton
{
if
let
v
=
switchCamerasButton
{
v
.
addTarget
(
self
,
action
:
#selector(
handleSwitchCamerasButton
)
,
for
:
.
touchUpInside
)
}
}
}
/// A reference to the flashButton.
open
var
flashButton
:
UIButton
?
{
open
var
flashButton
:
IconButton
!
{
didSet
{
if
let
v
:
UIButton
=
flashButton
{
if
let
v
=
flashButton
{
v
.
addTarget
(
self
,
action
:
#selector(
handleFlashButton
)
,
for
:
.
touchUpInside
)
}
}
...
...
@@ -291,22 +295,22 @@ open class Capture: View, UIGestureRecognizerDelegate {
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
preview
View
.
frame
=
bounds
preview
.
frame
=
bounds
if
let
v
:
UIButton
=
cameraButton
{
v
.
frame
.
origin
.
y
=
bounds
.
height
-
content
Inset
.
bottom
-
v
.
bounds
.
height
v
.
frame
.
origin
.
x
=
content
Inset
.
left
if
let
v
=
cameraButton
{
v
.
frame
.
origin
.
y
=
bounds
.
height
-
content
EdgeInsets
.
bottom
-
v
.
bounds
.
height
v
.
frame
.
origin
.
x
=
content
EdgeInsets
.
left
}
if
let
v
:
UIButton
=
captureButton
{
v
.
frame
.
origin
.
y
=
bounds
.
height
-
content
Inset
.
bottom
-
v
.
bounds
.
height
if
let
v
=
captureButton
{
v
.
frame
.
origin
.
y
=
bounds
.
height
-
content
EdgeInsets
.
bottom
-
v
.
bounds
.
height
v
.
frame
.
origin
.
x
=
(
bounds
.
width
-
v
.
bounds
.
width
)
/
2
}
if
let
v
:
UIButton
=
videoButton
{
v
.
frame
.
origin
.
y
=
bounds
.
height
-
content
Inset
.
bottom
-
v
.
bounds
.
height
v
.
frame
.
origin
.
x
=
bounds
.
width
-
v
.
bounds
.
width
-
content
Inset
.
right
if
let
v
=
videoButton
{
v
.
frame
.
origin
.
y
=
bounds
.
height
-
content
EdgeInsets
.
bottom
-
v
.
bounds
.
height
v
.
frame
.
origin
.
x
=
bounds
.
width
-
v
.
bounds
.
width
-
content
EdgeInsets
.
right
}
if
let
v
:
AVCaptureConnection
=
(
preview
View
.
layer
as!
AVCaptureVideoPreviewLayer
)
.
connection
{
v
.
videoOrientation
=
captureS
ession
.
videoOrientation
if
let
v
:
AVCaptureConnection
=
(
preview
.
layer
as!
AVCaptureVideoPreviewLayer
)
.
connection
{
v
.
videoOrientation
=
s
ession
.
videoOrientation
}
}
...
...
@@ -319,9 +323,17 @@ open class Capture: View, UIGestureRecognizerDelegate {
*/
open
override
func
prepare
()
{
super
.
prepare
()
backgroundColor
=
Color
.
black
backgroundColor
=
.
black
isTapToFocusEnabled
=
true
isTapToExposeEnabled
=
true
prepareCaptureSession
()
preparePreviewView
()
prepareCaptureButton
()
prepareCameraButton
()
prepareVideoButton
()
prepareSwitchCamerasButton
()
prepareFlashButton
()
}
/// Reloads the view.
...
...
@@ -332,17 +344,17 @@ open class Capture: View, UIGestureRecognizerDelegate {
v
.
removeFromSuperview
()
}
insertSubview
(
preview
View
,
at
:
0
)
insertSubview
(
preview
,
at
:
0
)
if
let
v
:
UIButton
=
captureButton
{
if
let
v
=
captureButton
{
insertSubview
(
v
,
at
:
1
)
}
if
let
v
:
UIButton
=
cameraButton
{
if
let
v
=
cameraButton
{
insertSubview
(
v
,
at
:
2
)
}
if
let
v
:
UIButton
=
videoButton
{
if
let
v
=
videoButton
{
insertSubview
(
v
,
at
:
3
)
}
}
...
...
@@ -357,7 +369,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
/// Updates the timer when recording.
internal
func
updateTimer
()
{
let
duration
:
CMTime
=
captureS
ession
.
recordedDuration
let
duration
:
CMTime
=
s
ession
.
recordedDuration
let
time
:
Double
=
CMTimeGetSeconds
(
duration
)
let
hours
:
Int
=
Int
(
time
/
3600
)
let
minutes
:
Int
=
Int
((
time
/
60
)
.
truncatingRemainder
(
dividingBy
:
60
))
...
...
@@ -367,7 +379,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
/// Stops the timer when recording.
internal
func
stopTimer
()
{
let
duration
:
CMTime
=
captureS
ession
.
recordedDuration
let
duration
:
CMTime
=
s
ession
.
recordedDuration
let
time
:
Double
=
CMTimeGetSeconds
(
duration
)
let
hours
:
Int
=
Int
(
time
/
3600
)
let
minutes
:
Int
=
Int
((
time
/
60
)
.
truncatingRemainder
(
dividingBy
:
60
))
...
...
@@ -392,7 +404,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
*/
@objc
internal
func
handleSwitchCamerasButton
(
button
:
UIButton
)
{
captureS
ession
.
switchCameras
()
s
ession
.
switchCameras
()
delegate
?
.
captureDidPressSwitchCamerasButton
?(
capture
:
self
,
button
:
button
)
}
...
...
@@ -403,13 +415,13 @@ open class Capture: View, UIGestureRecognizerDelegate {
@objc
internal
func
handleCaptureButton
(
button
:
UIButton
)
{
if
.
photo
==
captureMode
{
captureS
ession
.
captureStillImage
()
s
ession
.
captureStillImage
()
}
else
if
.
video
==
captureMode
{
if
captureS
ession
.
isRecording
{
captureS
ession
.
stopRecording
()
if
s
ession
.
isRecording
{
s
ession
.
stopRecording
()
stopTimer
()
}
else
{
captureS
ession
.
startRecording
()
s
ession
.
startRecording
()
startTimer
()
}
}
...
...
@@ -442,9 +454,9 @@ open class Capture: View, UIGestureRecognizerDelegate {
*/
@objc
internal
func
handleTapToFocusGesture
(
recognizer
:
UITapGestureRecognizer
)
{
if
enableTapToFocus
&&
captureS
ession
.
isFocusPointOfInterestSupported
{
if
isTapToFocusEnabled
&&
s
ession
.
isFocusPointOfInterestSupported
{
let
point
:
CGPoint
=
recognizer
.
location
(
in
:
self
)
captureSession
.
focus
(
at
:
previewV
iew
.
captureDevicePointOfInterestForPoint
(
point
:
point
))
session
.
focus
(
at
:
prev
iew
.
captureDevicePointOfInterestForPoint
(
point
:
point
))
animateTapLayer
(
layer
:
focusLayer
!
,
point
:
point
)
delegate
?
.
captureDidTapToFocusAtPoint
?(
capture
:
self
,
point
:
point
)
}
...
...
@@ -456,9 +468,9 @@ open class Capture: View, UIGestureRecognizerDelegate {
*/
@objc
internal
func
handleTapToExposeGesture
(
recognizer
:
UITapGestureRecognizer
)
{
if
enableTapToExpose
&&
captureS
ession
.
isExposurePointOfInterestSupported
{
if
isTapToExposeEnabled
&&
s
ession
.
isExposurePointOfInterestSupported
{
let
point
:
CGPoint
=
recognizer
.
location
(
in
:
self
)
captureSession
.
expose
(
at
:
previewV
iew
.
captureDevicePointOfInterestForPoint
(
point
:
point
))
session
.
expose
(
at
:
prev
iew
.
captureDevicePointOfInterestForPoint
(
point
:
point
))
animateTapLayer
(
layer
:
exposureLayer
!
,
point
:
point
)
delegate
?
.
captureDidTapToExposeAtPoint
?(
capture
:
self
,
point
:
point
)
}
...
...
@@ -470,9 +482,9 @@ open class Capture: View, UIGestureRecognizerDelegate {
*/
@objc
internal
func
handleTapToResetGesture
(
recognizer
:
UITapGestureRecognizer
)
{
if
enableTapToReset
{
captureS
ession
.
reset
()
let
point
:
CGPoint
=
preview
View
.
pointForCaptureDevicePointOfInterest
(
point
:
CGPoint
(
x
:
0.5
,
y
:
0.5
))
if
isTapToResetEnabled
{
s
ession
.
reset
()
let
point
:
CGPoint
=
preview
.
pointForCaptureDevicePointOfInterest
(
point
:
CGPoint
(
x
:
0.5
,
y
:
0.5
))
animateTapLayer
(
layer
:
resetLayer
!
,
point
:
point
)
delegate
?
.
captureDidTapToResetAtPoint
?(
capture
:
self
,
point
:
point
)
}
...
...
@@ -507,17 +519,43 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
}
/// Prepare the
captureS
ession.
/// Prepare the
s
ession.
private
func
prepareCaptureSession
()
{
captureS
ession
=
CaptureSession
()
s
ession
=
CaptureSession
()
}
/// Prepares the preview
View
.
/// Prepares the preview.
private
func
preparePreviewView
()
{
preview
View
=
CapturePreview
()
(
preview
View
.
layer
as!
AVCaptureVideoPreviewLayer
)
.
session
=
captureS
ession
.
session
captureS
ession
.
startSession
()
preview
=
CapturePreview
()
(
preview
.
layer
as!
AVCaptureVideoPreviewLayer
)
.
session
=
s
ession
.
session
s
ession
.
startSession
()
}
/// Prepares the captureButton.
private
func
prepareCaptureButton
()
{
captureButton
=
FabButton
()
}
/// Prepares the cameraButton.
private
func
prepareCameraButton
()
{
cameraButton
=
IconButton
(
image
:
Icon
.
cm
.
photoCamera
,
tintColor
:
.
white
)
}
/// Preapres the videoButton.
private
func
prepareVideoButton
()
{
videoButton
=
IconButton
(
image
:
Icon
.
cm
.
videocam
,
tintColor
:
.
white
)
}
/// Prepares the switchCameraButton.
private
func
prepareSwitchCamerasButton
()
{
switchCamerasButton
=
IconButton
(
image
:
UIImage
(
named
:
"ic_camera_front_white"
),
tintColor
:
.
white
)
}
/// Prepares the flashButton.
private
func
prepareFlashButton
()
{
flashButton
=
IconButton
(
image
:
UIImage
(
named
:
"ic_flash_auto_white"
),
tintColor
:
.
white
)
session
.
flashMode
=
.
auto
}
/// Prepares the focusLayer.
private
func
prepareFocusLayer
()
{
...
...
@@ -526,7 +564,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
focusLayer
!.
isHidden
=
true
focusLayer
!.
borderWidth
=
2
focusLayer
!.
borderColor
=
Color
.
white
.
cgColor
preview
View
.
layer
.
addSublayer
(
focusLayer
!
)
preview
.
layer
.
addSublayer
(
focusLayer
!
)
}
}
...
...
@@ -537,7 +575,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
exposureLayer
!.
isHidden
=
true
exposureLayer
!.
borderWidth
=
2
exposureLayer
!.
borderColor
=
Color
.
yellow
.
darken1
.
cgColor
preview
View
.
layer
.
addSublayer
(
exposureLayer
!
)
preview
.
layer
.
addSublayer
(
exposureLayer
!
)
}
}
...
...
@@ -548,7 +586,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
resetLayer
!.
isHidden
=
true
resetLayer
!.
borderWidth
=
2
resetLayer
!.
borderColor
=
Color
.
red
.
accent1
.
cgColor
preview
View
.
layer
.
addSublayer
(
resetLayer
!
)
preview
.
layer
.
addSublayer
(
resetLayer
!
)
}
}
...
...
Sources/iOS/CaptureController.swift
View file @
3386efad
...
...
@@ -29,7 +29,6 @@
*/
import
UIKit
import
Material
extension
UIViewController
{
/**
...
...
@@ -50,69 +49,59 @@ extension UIViewController {
}
open
class
CaptureController
:
ToolbarController
,
CaptureDelegate
,
CaptureSessionDelegate
{
/// A reference to the Capture instance.
open
private(set)
lazy
var
capture
:
Capture
=
Capture
()
open
private(set)
var
cameraButton
:
IconButton
!
open
private(set)
var
videoButton
:
IconButton
!
open
private(set)
var
switchCamerasButton
:
IconButton
!
open
private(set)
var
flashButton
:
IconButton
!
open
private(set)
var
captureButton
:
FabButton
!
open
override
func
prepare
()
{
super
.
prepare
()
view
.
backgroundColor
=
Color
.
black
display
=
.
full
prepareToolbar
()
prepareCaptureButton
()
prepareCameraButton
()
prepareVideoButton
()
prepareSwitchCamerasButton
()
prepareFlashButton
()
prepareCapture
()
/// A reference to capture's cameraButton.
open
var
cameraButton
:
IconButton
{
return
capture
.
cameraButton
}
/// Prepares the Toolbar.
private
func
prepareToolbar
()
{
toolbar
.
backgroundColor
=
Color
.
clear
toolbar
.
depthPreset
=
.
none
/// A reference to capture's videoButton.
open
var
videoButton
:
IconButton
{
return
capture
.
videoButton
}
/// Prepares the captureButton.
private
func
prepareCaptureButton
()
{
captureButton
=
FabButton
()
capture
.
captureButton
=
captureButton
/// A reference to capture's switchCamerasButton.
open
var
switchCamerasButton
:
IconButton
{
return
capture
.
switchCamerasButton
}
/// Prepares the cameraButton.
private
func
prepareCameraButton
()
{
cameraButton
=
IconButton
(
image
:
Icon
.
cm
.
photoCamera
,
tintColor
:
Color
.
white
)
capture
.
cameraButton
=
cameraButton
/// A reference to capture's flashButton.
open
var
flashButton
:
IconButton
{
return
capture
.
flashButton
}
/// Preapres the videoButton.
private
func
prepareVideoButton
()
{
videoButton
=
IconButton
(
image
:
Icon
.
cm
.
videocam
,
tintColor
:
Color
.
white
)
capture
.
videoButton
=
videoButton
/// A reference to capture's captureButton.
open
var
captureButton
:
FabButton
{
return
capture
.
captureButton
}
/// Prepares the switchCameraButton.
private
func
prepareSwitchCamerasButton
()
{
switchCamerasButton
=
IconButton
(
image
:
UIImage
(
named
:
"ic_camera_front_white"
),
tintColor
:
Color
.
white
)
capture
.
switchCamerasButton
=
switchCamerasButton
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method
to initialize property values and other setup operations.
The super.prepare method should always be called immediately
when subclassing.
*/
open
override
func
prepare
()
{
super
.
prepare
()
view
.
backgroundColor
=
.
black
display
=
.
full
prepareToolbar
()
prepareCapture
()
}
/// Prepares the flashButton.
private
func
prepareFlashButton
()
{
flashButton
=
IconButton
(
image
:
UIImage
(
named
:
"ic_flash_auto_white"
),
tintColor
:
Color
.
white
)
capture
.
flashButton
=
flashButton
capture
.
captureSession
.
flashMode
=
.
auto
/// Prepares the Toolbar.
private
func
prepareToolbar
()
{
toolbar
.
backgroundColor
=
.
clear
toolbar
.
depthPreset
=
.
none
}
/// Prepares capture.
private
func
prepareCapture
()
{
capture
.
enableTapToFocus
=
true
capture
.
enableTapToExpose
=
true
capture
.
delegate
=
self
capture
.
captureS
ession
.
delegate
=
self
capture
.
s
ession
.
delegate
=
self
}
}
Sources/iOS/CaptureSession.swift
View file @
3386efad
...
...
@@ -90,82 +90,82 @@ public func CaptureSessionPresetToString(preset: CaptureSessionPreset) -> String
public
protocol
CaptureSessionDelegate
{
/**
A delegation method that is fired when the captureSesstion failes with an error.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter error: A Error corresponding to the error.
*/
@objc
optional
func
captureSessionFailedWithError
(
captureS
ession
:
CaptureSession
,
error
:
Error
)
optional
func
sessionFailedWithError
(
s
ession
:
CaptureSession
,
error
:
Error
)
/**
A delegation method that is fired when the camera has been switched to another.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter position: An AVCaptureDevicePosition that the camera has switched to.
*/
@objc
optional
func
captureSessionDidSwitchCameras
(
captureS
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
optional
func
sessionDidSwitchCameras
(
s
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
/**
A delegation method that is fired before the camera has been switched to another.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter position: An AVCaptureDevicePosition that the camera will switch to.
*/
@objc
optional
func
captureSessionWillSwitchCameras
(
captureS
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
optional
func
sessionWillSwitchCameras
(
s
ession
:
CaptureSession
,
position
:
AVCaptureDevicePosition
)
/**
A delegation method that is fired when an image has been captured asynchronously.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter image: An image that has been captured.
*/
@objc
optional
func
captureSessionStillImageAsynchronously
(
captureS
ession
:
CaptureSession
,
image
:
UIImage
)
optional
func
sessionStillImageAsynchronously
(
s
ession
:
CaptureSession
,
image
:
UIImage
)
/**
A delegation method that is fired when capturing an image asynchronously has failed.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter error: A Error corresponding to the error.
*/
@objc
optional
func
captureSessionStillImageAsynchronouslyFailedWithError
(
captureS
ession
:
CaptureSession
,
error
:
Error
)
optional
func
sessionStillImageAsynchronouslyFailedWithError
(
s
ession
:
CaptureSession
,
error
:
Error
)
/**
A delegation method that is fired when creating a movie file has failed.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter error: A Error corresponding to the error.
*/
@objc
optional
func
captureSessionCreateMovieFileFailedWithError
(
captureS
ession
:
CaptureSession
,
error
:
Error
)
optional
func
sessionCreateMovieFileFailedWithError
(
s
ession
:
CaptureSession
,
error
:
Error
)
/**
A delegation method that is fired when capturing a movie has failed.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter error: A Error corresponding to the error.
*/
@objc
optional
func
captureSessionMovieFailedWithError
(
captureS
ession
:
CaptureSession
,
error
:
Error
)
optional
func
sessionMovieFailedWithError
(
s
ession
:
CaptureSession
,
error
:
Error
)
/**
A delegation method that is fired when a session started recording and writing
to a file.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter captureOut: An AVCaptureFileOutput.
- Parameter fileURL: A file URL.
- Parameter fromConnections: An array of Anys.
*/
@objc
optional
func
captureSessionDidStartRecordingToOutputFileAtURL
(
captureS
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
fileURL
:
NSURL
,
fromConnections
connections
:
[
Any
])
optional
func
sessionDidStartRecordingToOutputFileAtURL
(
s
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
fileURL
:
NSURL
,
fromConnections
connections
:
[
Any
])
/**
A delegation method that is fired when a session finished recording and writing
to a file.
- Parameter
captureS
ession: A reference to the calling CaptureSession.
- Parameter
s
ession: A reference to the calling CaptureSession.
- Parameter captureOut: An AVCaptureFileOutput.
- Parameter fileURL: A file URL.
- Parameter fromConnections: An array of Anys.
- Parameter error: A Error corresponding to an error.
*/
@objc
optional
func
captureSessionDidFinishRecordingToOutputFileAtURL
(
captureS
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
outputFileURL
:
NSURL
,
fromConnections
connections
:
[
Any
],
error
:
Error
!
)
optional
func
sessionDidFinishRecordingToOutputFileAtURL
(
s
ession
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
outputFileURL
:
NSURL
,
fromConnections
connections
:
[
Any
],
error
:
Error
!
)
}
@objc(CaptureSession)
...
...
@@ -279,7 +279,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
userInfo
[
NSUnderlyingErrorKey
]
=
error
}
if
let
e
=
error
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
}
...
...
@@ -308,7 +308,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
userInfo
[
NSUnderlyingErrorKey
]
=
error
}
if
let
e
=
error
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
}
...
...
@@ -337,7 +337,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
userInfo
[
NSUnderlyingErrorKey
]
=
error
}
if
let
e
:
NSError
=
error
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
}
...
...
@@ -403,7 +403,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
if
canSwitchCameras
{
do
{
if
let
v
:
AVCaptureDevicePosition
=
position
{
delegate
?
.
captureSessionWillSwitchCameras
?(
captureS
ession
:
self
,
position
:
v
)
delegate
?
.
sessionWillSwitchCameras
?(
s
ession
:
self
,
position
:
v
)
let
videoInput
:
AVCaptureDeviceInput
?
=
try
AVCaptureDeviceInput
(
device
:
inactiveCamera
!
)
session
.
beginConfiguration
()
session
.
removeInput
(
activeVideoInput
)
...
...
@@ -415,10 +415,10 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
session
.
addInput
(
activeVideoInput
)
}
session
.
commitConfiguration
()
delegate
?
.
captureSessionDidSwitchCameras
?(
captureS
ession
:
self
,
position
:
position
!
)
delegate
?
.
sessionDidSwitchCameras
?(
s
ession
:
self
,
position
:
position
!
)
}
}
catch
let
e
as
NSError
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
}
...
...
@@ -483,7 +483,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
userInfo
[
NSUnderlyingErrorKey
]
=
error
}
if
let
e
=
error
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
...
...
@@ -514,7 +514,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
userInfo
[
NSUnderlyingErrorKey
]
=
error
}
if
let
e
=
error
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
...
...
@@ -529,7 +529,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
device
.
exposureMode
=
.
locked
device
.
unlockForConfiguration
()
}
catch
let
e
as
NSError
{
self
.
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
self
.
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
}
...
...
@@ -560,7 +560,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
}
device
.
unlockForConfiguration
()
}
catch
let
e
as
NSError
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
...
...
@@ -577,7 +577,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
let
data
=
AVCaptureStillImageOutput
.
jpegStillImageNSDataRepresentation
(
sampleBuffer
)
!
if
let
image1
=
UIImage
(
data
:
data
)
{
if
let
image2
=
image1
.
adjustOrientation
()
{
s
.
delegate
?
.
captureSessionStillImageAsynchronously
?(
captureS
ession
:
s
,
image
:
image2
)
s
.
delegate
?
.
sessionStillImageAsynchronously
?(
s
ession
:
s
,
image
:
image2
)
}
else
{
var
userInfo
=
[
String
:
Any
]()
userInfo
[
NSLocalizedDescriptionKey
]
=
"[Material Error: Cannot fix image orientation.]"
...
...
@@ -595,7 +595,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
}
if
let
e
:
Error
=
captureError
{
s
.
delegate
?
.
captureSessionStillImageAsynchronouslyFailedWithError
?(
captureS
ession
:
s
,
error
:
e
)
s
.
delegate
?
.
sessionStillImageAsynchronouslyFailedWithError
?(
s
ession
:
s
,
error
:
e
)
}
}
}
...
...
@@ -620,7 +620,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
v
.
isSmoothAutoFocusEnabled
=
true
v
.
unlockForConfiguration
()
}
catch
let
e
as
NSError
{
s
.
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
s
,
error
:
e
)
s
.
delegate
?
.
sessionFailedWithError
?(
s
ession
:
s
,
error
:
e
)
}
}
...
...
@@ -643,12 +643,12 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
public
func
capture
(
_
captureOutput
:
AVCaptureFileOutput
!
,
didStartRecordingToOutputFileAt
fileURL
:
URL
!
,
fromConnections
connections
:
[
Any
]
!
)
{
isRecording
=
true
delegate
?
.
captureSessionDidStartRecordingToOutputFileAtURL
?(
captureS
ession
:
self
,
captureOutput
:
captureOutput
,
fileURL
:
fileURL
as
NSURL
,
fromConnections
:
connections
)
delegate
?
.
sessionDidStartRecordingToOutputFileAtURL
?(
s
ession
:
self
,
captureOutput
:
captureOutput
,
fileURL
:
fileURL
as
NSURL
,
fromConnections
:
connections
)
}
public
func
capture
(
_
captureOutput
:
AVCaptureFileOutput
!
,
didFinishRecordingToOutputFileAt
outputFileURL
:
URL
!
,
fromConnections
connections
:
[
Any
]
!
,
error
:
Error
!
)
{
isRecording
=
false
delegate
?
.
captureSessionDidFinishRecordingToOutputFileAtURL
?(
captureS
ession
:
self
,
captureOutput
:
captureOutput
,
outputFileURL
:
outputFileURL
as
NSURL
,
fromConnections
:
connections
,
error
:
error
)
delegate
?
.
sessionDidFinishRecordingToOutputFileAtURL
?(
s
ession
:
self
,
captureOutput
:
captureOutput
,
outputFileURL
:
outputFileURL
as
NSURL
,
fromConnections
:
connections
,
error
:
error
)
}
/// Prepares the sessionQueue.
...
...
@@ -669,7 +669,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
session
.
addInput
(
activeVideoInput
)
}
}
catch
let
e
as
NSError
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
...
...
@@ -681,7 +681,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
session
.
addInput
(
activeAudioInput
)
}
}
catch
let
e
as
NSError
{
delegate
?
.
captureSessionFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
}
...
...
@@ -729,7 +729,7 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
dateFormatter
.
timeStyle
=
.
full
return
directory
.
appendingPathComponent
(
dateFormatter
.
string
(
from
:
NSDate
()
as
Date
)
+
".mov"
)
}
catch
let
e
as
NSError
{
delegate
?
.
captureSessionCreateMovieFileFailedWithError
?(
captureS
ession
:
self
,
error
:
e
)
delegate
?
.
sessionCreateMovieFileFailedWithError
?(
s
ession
:
self
,
error
:
e
)
}
return
nil
}
...
...
Sources/iOS/CollectionReusableView.swift
View file @
3386efad
...
...
@@ -157,7 +157,7 @@ open class CollectionReusableView: UICollectionReusableView {
}
/// A reference to EdgeInsets.
@IBInspectable
open
var
content
Inset
:
UIEdgeInsets
{
@IBInspectable
open
var
content
EdgeInsets
:
UIEdgeInsets
{
get
{
return
grid
.
contentEdgeInsets
}
...
...
@@ -183,7 +183,7 @@ open class CollectionReusableView: UICollectionReusableView {
}
}
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
didSet
{
layer
.
backgroundColor
=
backgroundColor
?
.
cgColor
...
...
Sources/iOS/CollectionView.swift
View file @
3386efad
...
...
@@ -41,7 +41,7 @@ open class CollectionView: UICollectionView {
}
}
open
override
var
contentInset
:
UI
EdgeInsets
{
open
var
contentEdgeInsets
:
EdgeInsets
{
get
{
return
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
contentEdgeInsets
}
...
...
@@ -68,7 +68,8 @@ open class CollectionView: UICollectionView {
}
/// Spacing between items.
@IBInspectable
open
var
interimSpace
:
InterimSpace
{
@IBInspectable
open
var
interimSpace
:
InterimSpace
{
get
{
return
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
interimSpace
}
...
...
@@ -119,7 +120,7 @@ open class CollectionView: UICollectionView {
*/
open
func
prepare
()
{
contentScaleFactor
=
Device
.
scale
backgroundColor
=
Color
.
clear
content
Inset
=
.
zero
backgroundColor
=
.
clear
content
EdgeInsets
=
.
zero
}
}
Sources/iOS/CollectionViewCell.swift
View file @
3386efad
...
...
@@ -162,7 +162,7 @@ open class CollectionViewCell: UICollectionViewCell {
/// A reference to EdgeInsets.
@IBInspectable
open
var
content
Inset
:
EdgeInsets
{
open
var
content
EdgeInsets
:
EdgeInsets
{
get
{
return
contentView
.
grid
.
contentEdgeInsets
}
...
...
@@ -189,7 +189,7 @@ open class CollectionViewCell: UICollectionViewCell {
}
}
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
didSet
{
...
...
Sources/iOS/Color.swift
View file @
3386efad
...
...
@@ -56,30 +56,21 @@ public protocol ColorPalette {
optional
static
var
accent4
:
UIColor
{
get
}
}
open
class
Color
{
// clear
open
static
let
clear
=
UIColor
.
clear
// white
open
static
let
white
=
UIColor
.
white
// black
open
static
let
black
=
UIColor
.
black
open
class
Color
:
UIColor
{
// dark text
open
class
darkText
{
open
static
let
primary
=
Color
.
black
.
withAlphaComponent
(
0.87
)
open
static
let
secondary
=
Color
.
black
.
withAlphaComponent
(
0.54
)
open
static
let
others
=
Color
.
black
.
withAlphaComponent
(
0.38
)
open
static
let
dividers
=
Color
.
black
.
withAlphaComponent
(
0.12
)
open
static
let
primary
=
black
.
withAlphaComponent
(
0.87
)
open
static
let
secondary
=
black
.
withAlphaComponent
(
0.54
)
open
static
let
others
=
black
.
withAlphaComponent
(
0.38
)
open
static
let
dividers
=
black
.
withAlphaComponent
(
0.12
)
}
// light text
open
class
lightText
{
open
static
let
primary
=
Color
.
white
open
static
let
secondary
=
Color
.
white
.
withAlphaComponent
(
0.7
)
open
static
let
others
=
Color
.
white
.
withAlphaComponent
(
0.5
)
open
static
let
dividers
=
Color
.
white
.
withAlphaComponent
(
0.12
)
open
static
let
primary
=
white
open
static
let
secondary
=
white
.
withAlphaComponent
(
0.7
)
open
static
let
others
=
white
.
withAlphaComponent
(
0.5
)
open
static
let
dividers
=
white
.
withAlphaComponent
(
0.12
)
}
// red
...
...
Sources/iOS/Divider.swift
View file @
3386efad
...
...
@@ -48,7 +48,7 @@ open class Divider {
/// A reference to the height.
public
var
height
:
CGFloat
/// A UI
Color.
/// A UI
open
var
color
:
UIColor
?
{
get
{
return
line
?
.
backgroundColor
...
...
Sources/iOS/FabButton.swift
View file @
3386efad
...
...
@@ -43,8 +43,8 @@ open class FabButton: Button {
depthPreset
=
.
depth1
shapePreset
=
.
circle
pulseAnimation
=
.
centerWithBacking
tintColor
=
Color
.
white
pulseColor
=
Color
.
white
tintColor
=
.
white
pulseColor
=
.
white
backgroundColor
=
Color
.
red
.
base
}
}
Sources/iOS/Material+CALayer.swift
View file @
3386efad
...
...
@@ -239,7 +239,7 @@ extension CALayer {
}
}
/// A UIColor reference to the `background
Color.
cgColor`.
/// A UIColor reference to the `backgroundcgColor`.
open
var
color
:
UIColor
?
{
get
{
return
nil
==
backgroundColor
?
nil
:
UIColor
(
cgColor
:
backgroundColor
!
)
...
...
Sources/iOS/Material+UIImage.swift
View file @
3386efad
...
...
@@ -100,7 +100,7 @@ extension UIImage {
- Parameter color: The UIColor to create the image from.
- Returns: A UIImage that is the color passed in.
*/
open
func
tint
WithColor
(
color
:
UIColor
)
->
UIImage
?
{
open
func
tint
(
with
color
:
UIColor
)
->
UIImage
?
{
UIGraphicsBeginImageContextWithOptions
(
size
,
false
,
Device
.
scale
)
guard
let
context
=
UIGraphicsGetCurrentContext
()
else
{
return
nil
...
...
@@ -129,7 +129,7 @@ extension UIImage {
- Parameter size: The size of the image to create.
- Returns: A UIImage that is the color passed in.
*/
open
class
func
image
WithColor
(
color
:
UIColor
,
size
:
CGSize
)
->
UIImage
?
{
open
class
func
image
(
with
color
:
UIColor
,
size
:
CGSize
)
->
UIImage
?
{
let
rect
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
size
.
width
,
height
:
size
.
height
)
UIGraphicsBeginImageContextWithOptions
(
size
,
false
,
0
)
color
.
setFill
()
...
...
Sources/iOS/Material+UIView.swift
View file @
3386efad
...
...
@@ -110,7 +110,7 @@ extension UIView {
}
}
/// A property that accesses the backing layer's shadow
Color.
/// A property that accesses the backing layer's shadow
@IBInspectable
open
var
shadowColor
:
UIColor
?
{
get
{
...
...
Sources/iOS/MenuItem.swift
View file @
3386efad
...
...
@@ -98,7 +98,7 @@ open class MenuItem: View {
private
func
prepareTitleLabel
()
{
titleLabel
.
font
=
RobotoFont
.
regular
(
with
:
14
)
titleLabel
.
textAlignment
=
.
center
titleLabel
.
backgroundColor
=
Color
.
white
titleLabel
.
backgroundColor
=
.
white
titleLabel
.
depthPreset
=
button
.
depthPreset
titleLabel
.
cornerRadiusPreset
=
.
cornerRadius1
addSubview
(
titleLabel
)
...
...
Sources/iOS/NavigationBar.swift
View file @
3386efad
...
...
@@ -115,7 +115,7 @@ open class NavigationBar: UINavigationBar {
}
}
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
didSet
{
...
...
@@ -300,7 +300,7 @@ open class NavigationBar: UINavigationBar {
The super.prepare method should always be called immediately
when subclassing.
*/
public
func
prepare
()
{
open
func
prepare
()
{
barStyle
=
.
black
isTranslucent
=
false
depthPreset
=
.
depth1
...
...
@@ -308,10 +308,10 @@ open class NavigationBar: UINavigationBar {
contentEdgeInsetsPreset
=
.
square1
contentScaleFactor
=
Device
.
scale
backButtonImage
=
Icon
.
cm
.
arrowBack
let
image
=
UIImage
.
image
WithColor
(
color
:
Color
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
let
image
=
UIImage
.
image
(
with
:
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
shadowImage
=
image
setBackgroundImage
(
image
,
for
:
.
default
)
backgroundColor
=
Color
.
white
backgroundColor
=
.
white
}
/**
...
...
Sources/iOS/NavigationController.swift
View file @
3386efad
...
...
@@ -112,7 +112,7 @@ open class NavigationController: UINavigationController {
*/
open
func
prepare
()
{
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
.
white
view
.
contentScaleFactor
=
Device
.
scale
// This ensures the panning gesture is available when going back between views.
...
...
Sources/iOS/NavigationDrawerController.swift
View file @
3386efad
...
...
@@ -975,7 +975,7 @@ open class NavigationDrawerController: RootController, UIGestureRecognizerDelega
/// Prepares the contentViewController.
private
func
prepareContentViewController
()
{
contentViewController
.
view
.
backgroundColor
=
Color
.
black
contentViewController
.
view
.
backgroundColor
=
.
black
prepare
(
viewController
:
contentViewController
,
withContainer
:
view
)
view
.
sendSubview
(
toBack
:
contentViewController
.
view
)
}
...
...
Sources/iOS/PhotoLibraryController.swift
View file @
3386efad
...
...
@@ -48,7 +48,7 @@ open class PhotoLibraryController: UIViewController {
*/
open
func
prepare
()
{
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
.
white
view
.
contentScaleFactor
=
Device
.
scale
preparePhotoLibrary
()
}
...
...
Sources/iOS/Pulse.swift
View file @
3386efad
...
...
@@ -34,7 +34,7 @@ internal struct Pulse {
/// An Array of layers.
internal
lazy
var
layers
=
[
CAShapeLayer
]()
/// A UI
Color.
/// A UI
internal
var
color
=
Color
.
blueGrey
.
base
/// A reference to the PulseAnimation.
...
...
Sources/iOS/RaisedButton.swift
View file @
3386efad
...
...
@@ -42,6 +42,6 @@ open class RaisedButton: Button {
super
.
prepare
()
depthPreset
=
.
depth1
cornerRadiusPreset
=
.
cornerRadius1
backgroundColor
=
Color
.
white
backgroundColor
=
.
white
}
}
Sources/iOS/RootController.swift
View file @
3386efad
...
...
@@ -152,7 +152,7 @@ open class RootController: UIViewController {
*/
open
func
prepare
()
{
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
Color
.
white
view
.
backgroundColor
=
.
white
view
.
contentScaleFactor
=
Device
.
scale
prepareRootViewController
()
}
...
...
Sources/iOS/SearchBar.swift
View file @
3386efad
...
...
@@ -74,17 +74,17 @@ open class SearchBar: Bar {
@IBInspectable
open
var
placeholder
:
String
?
{
didSet
{
if
let
v
:
String
=
placeholder
{
if
let
v
=
placeholder
{
textField
.
attributedPlaceholder
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSForegroundColorAttributeName
:
placeholderColor
])
}
}
}
/// Placeholder text
Color.
/// Placeholder text
@IBInspectable
open
var
placeholderColor
=
Color
.
darkText
.
others
{
didSet
{
if
let
v
:
String
=
placeholder
{
if
let
v
=
placeholder
{
textField
.
attributedPlaceholder
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSForegroundColorAttributeName
:
placeholderColor
])
}
}
...
...
Sources/iOS/Switch.swift
View file @
3386efad
...
...
@@ -89,7 +89,7 @@ open class Switch: UIControl {
/// Indicates if the animation should bounce.
@IBInspectable
public
var
bounceable
=
true
{
open
var
bounceable
=
true
{
didSet
{
bounceOffset
=
bounceable
?
3
:
0
}
...
...
@@ -97,7 +97,7 @@ open class Switch: UIControl {
/// Button on color.
@IBInspectable
public
var
buttonOnColor
=
Color
.
clear
{
open
var
buttonOnColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
...
...
@@ -105,7 +105,7 @@ open class Switch: UIControl {
/// Button off color.
@IBInspectable
public
var
buttonOffColor
=
Color
.
clear
{
open
var
buttonOffColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
...
...
@@ -113,7 +113,7 @@ open class Switch: UIControl {
/// Track on color.
@IBInspectable
public
var
trackOnColor
=
Color
.
clear
{
open
var
trackOnColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
...
...
@@ -121,7 +121,7 @@ open class Switch: UIControl {
/// Track off color.
@IBInspectable
public
var
trackOffColor
=
Color
.
clear
{
open
var
trackOffColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
...
...
@@ -129,7 +129,7 @@ open class Switch: UIControl {
/// Button on disabled color.
@IBInspectable
public
var
buttonOnDisabledColor
=
Color
.
clear
{
open
var
buttonOnDisabledColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
...
...
@@ -137,7 +137,7 @@ open class Switch: UIControl {
/// Track on disabled color.
@IBInspectable
public
var
trackOnDisabledColor
=
Color
.
clear
{
open
var
trackOnDisabledColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
...
...
@@ -145,7 +145,7 @@ open class Switch: UIControl {
/// Button off disabled color.
@IBInspectable
public
var
buttonOffDisabledColor
=
Color
.
clear
{
open
var
buttonOffDisabledColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
...
...
@@ -153,21 +153,21 @@ open class Switch: UIControl {
/// Track off disabled color.
@IBInspectable
public
var
trackOffDisabledColor
=
Color
.
clear
{
open
var
trackOffDisabledColor
=
Color
.
clear
{
didSet
{
styleForState
(
state
:
switchState
)
}
}
/// Track view reference.
public
private(set)
var
track
:
UIView
{
open
private(set)
var
track
:
UIView
{
didSet
{
prepareTrack
()
}
}
/// Button view reference.
public
private(set)
var
button
:
FabButton
{
open
private(set)
var
button
:
FabButton
{
didSet
{
prepareButton
()
}
...
...
Sources/iOS/TableViewCell.swift
View file @
3386efad
...
...
@@ -74,7 +74,7 @@ open class TableViewCell: UITableViewCell {
}
}
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
didSet
{
...
...
Sources/iOS/TextField.swift
View file @
3386efad
...
...
@@ -125,7 +125,7 @@ open class TextField: UITextField {
@IBInspectable
open
private(set)
var
placeholderLabel
:
UILabel
!
/// Placeholder normal text
Color.
/// Placeholder normal text
@IBInspectable
open
var
placeholderNormalColor
=
Color
.
darkText
.
others
{
didSet
{
...
...
@@ -141,7 +141,7 @@ open class TextField: UITextField {
}
}
/// Placeholder active text
Color.
/// Placeholder active text
@IBInspectable
open
var
placeholderActiveColor
=
Color
.
blue
.
base
{
didSet
{
...
...
@@ -178,7 +178,7 @@ open class TextField: UITextField {
}
}
/// Detail text
Color.
/// Detail text
@IBInspectable
open
var
detailColor
=
Color
.
darkText
.
others
{
didSet
{
...
...
Sources/iOS/TextView.swift
View file @
3386efad
...
...
@@ -35,7 +35,7 @@ public protocol TextViewDelegate : UITextViewDelegate {}
@objc(TextView)
public
class
TextView
:
UITextView
{
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
public
override
var
backgroundColor
:
UIColor
?
{
didSet
{
layer
.
backgroundColor
=
backgroundColor
?
.
cgColor
...
...
@@ -223,7 +223,7 @@ public class TextView: UITextView {
public
func
prepare
()
{
contentScaleFactor
=
Device
.
scale
textContainerInset
=
.
zero
backgroundColor
=
Color
.
white
backgroundColor
=
.
white
clipsToBounds
=
false
removeNotificationHandlers
()
prepareNotificationHandlers
()
...
...
@@ -236,7 +236,7 @@ public class TextView: UITextView {
v
.
font
=
font
v
.
textAlignment
=
textAlignment
v
.
numberOfLines
=
0
v
.
backgroundColor
=
Color
.
clear
v
.
backgroundColor
=
.
clear
addSubview
(
v
)
reloadView
()
handleTextViewTextDidChange
()
...
...
Sources/iOS/View.swift
View file @
3386efad
...
...
@@ -116,7 +116,7 @@ open class View: UIView {
}
}
/// A property that accesses the backing layer's background
Color.
/// A property that accesses the backing layer's background
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
didSet
{
...
...
Sources/macOS/Color.swift
View file @
3386efad
...
...
@@ -58,28 +58,28 @@ public protocol ColorPalette {
open
class
Color
{
// clear
open
static
let
clear
=
NS
Color
.
clear
open
static
let
clear
=
NSclear
// white
open
static
let
white
=
NS
Color
.
white
open
static
let
white
=
NSwhite
// black
open
static
let
black
=
NS
Color
.
black
open
static
let
black
=
NSblack
// dark text
open
class
darkText
{
open
static
let
primary
=
Color
.
black
.
withAlphaComponent
(
0.87
)
open
static
let
secondary
=
Color
.
black
.
withAlphaComponent
(
0.54
)
open
static
let
others
=
Color
.
black
.
withAlphaComponent
(
0.38
)
open
static
let
dividers
=
Color
.
black
.
withAlphaComponent
(
0.12
)
open
static
let
primary
=
black
.
withAlphaComponent
(
0.87
)
open
static
let
secondary
=
black
.
withAlphaComponent
(
0.54
)
open
static
let
others
=
black
.
withAlphaComponent
(
0.38
)
open
static
let
dividers
=
black
.
withAlphaComponent
(
0.12
)
}
// light text
open
class
lightText
{
open
static
let
primary
=
Color
.
white
open
static
let
secondary
=
Color
.
white
.
withAlphaComponent
(
0.7
)
open
static
let
others
=
Color
.
white
.
withAlphaComponent
(
0.5
)
open
static
let
dividers
=
Color
.
white
.
withAlphaComponent
(
0.12
)
open
static
let
primary
=
white
open
static
let
secondary
=
white
.
withAlphaComponent
(
0.7
)
open
static
let
others
=
white
.
withAlphaComponent
(
0.5
)
open
static
let
dividers
=
white
.
withAlphaComponent
(
0.12
)
}
// red
...
...
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