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
58a5469c
Commit
58a5469c
authored
Apr 22, 2017
by
Daniel Dahan
Committed by
GitHub
Apr 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' into development
parents
9b743d59
98166c9a
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
759 additions
and
311 deletions
+759
-311
Material.xcodeproj/project.pbxproj
+13
-13
Sources/iOS/Bar.swift
+14
-11
Sources/iOS/BottomNavigationController.swift
+6
-1
Sources/iOS/Capture/CaptureController.swift
+1
-1
Sources/iOS/CollectionViewCard.swift
+17
-14
Sources/iOS/DisplayStyle.swift
+2
-2
Sources/iOS/ImageCard.swift
+2
-1
Sources/iOS/Material+Motion.swift
+175
-46
Sources/iOS/PageMenuController.swift
+457
-0
Sources/iOS/PageTabBarController.swift
+0
-1
Sources/iOS/SearchBarController.swift
+2
-12
Sources/iOS/Snackbar.swift
+5
-3
Sources/iOS/StatusBarController.swift
+2
-2
Sources/iOS/TabBar.swift
+44
-5
Sources/iOS/TabMenuController.swift
+0
-168
Sources/iOS/TextField.swift
+12
-15
Sources/iOS/TextView.swift
+0
-1
Sources/iOS/Toolbar.swift
+5
-3
Sources/iOS/ToolbarController.swift
+2
-12
No files found.
Material.xcodeproj/project.pbxproj
View file @
58a5469c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
objects
=
{
objects
=
{
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
9606CFAC1E957AC3006B4E74
/*
TabMenuController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9606CFAB1E957AC3006B4E74
/* Tab
MenuController.swift */
;
};
9606CFAC1E957AC3006B4E74
/*
PageMenuController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9606CFAB1E957AC3006B4E74
/* Page
MenuController.swift */
;
};
961409B01E43D15C00E7BA99
/* CollectionViewCard.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961730591E145DE900A9A297
/* CollectionViewCard.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
961409B01E43D15C00E7BA99
/* CollectionViewCard.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961730591E145DE900A9A297
/* CollectionViewCard.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
961409B11E43D15C00E7BA99
/* FABMenu.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A183621E0C6CE200083C30
/* FABMenu.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
961409B11E43D15C00E7BA99
/* FABMenu.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A183621E0C6CE200083C30
/* FABMenu.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
961409B21E43D15C00E7BA99
/* FABMenuController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A183641E0C6DD400083C30
/* FABMenuController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
961409B21E43D15C00E7BA99
/* FABMenuController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A183641E0C6DD400083C30
/* FABMenuController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
9617B0871DFCA8CF00410F8F
/* PageTabBarController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963FBF071D669D14008F8512
/* PageTabBarController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B0871DFCA8CF00410F8F
/* PageTabBarController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963FBF071D669D14008F8512
/* PageTabBarController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B0881DFCA8CF00410F8F
/* PhotoLibrary.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B161DBE6B1800DA84DB
/* PhotoLibrary.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B0881DFCA8CF00410F8F
/* PhotoLibrary.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B161DBE6B1800DA84DB
/* PhotoLibrary.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B0891DFCA8CF00410F8F
/* PhotoLibraryController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B171DBE6B1800DA84DB
/* PhotoLibraryController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B0891DFCA8CF00410F8F
/* PhotoLibraryController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B171DBE6B1800DA84DB
/* PhotoLibraryController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08A1DFCA8CF00410F8F
/* Display
.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9626CA961DAB53A8003E2611
/* Display
.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08A1DFCA8CF00410F8F
/* Display
Style.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9626CA961DAB53A8003E2611
/* DisplayStyle
.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08B1DFCA8CF00410F8F
/* Screen.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961E6BE11DDA2AF3004E6C93
/* Screen.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08B1DFCA8CF00410F8F
/* Screen.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961E6BE11DDA2AF3004E6C93
/* Screen.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08C1DFCA8CF00410F8F
/* SearchBar.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7951CB40DC500C806FE
/* SearchBar.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08C1DFCA8CF00410F8F
/* SearchBar.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7951CB40DC500C806FE
/* SearchBar.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08D1DFCA8CF00410F8F
/* SearchBarController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7961CB40DC500C806FE
/* SearchBarController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B08D1DFCA8CF00410F8F
/* SearchBarController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7961CB40DC500C806FE
/* SearchBarController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
@@ -103,7 +103,7 @@
...
@@ -103,7 +103,7 @@
965E81131DD4D5C800D61E4B
/* NavigationDrawerController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7971CB40DC500C806FE
/* NavigationDrawerController.swift */
;
};
965E81131DD4D5C800D61E4B
/* NavigationDrawerController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7971CB40DC500C806FE
/* NavigationDrawerController.swift */
;
};
965E81141DD4D5C800D61E4B
/* PhotoLibrary.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B161DBE6B1800DA84DB
/* PhotoLibrary.swift */
;
};
965E81141DD4D5C800D61E4B
/* PhotoLibrary.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B161DBE6B1800DA84DB
/* PhotoLibrary.swift */
;
};
965E81151DD4D5C800D61E4B
/* PhotoLibraryController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B171DBE6B1800DA84DB
/* PhotoLibraryController.swift */
;
};
965E81151DD4D5C800D61E4B
/* PhotoLibraryController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96717B171DBE6B1800DA84DB
/* PhotoLibraryController.swift */
;
};
965E81161DD4D5C800D61E4B
/* Display
.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9626CA961DAB53A8003E2611
/* Display
.swift */
;
};
965E81161DD4D5C800D61E4B
/* Display
Style.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9626CA961DAB53A8003E2611
/* DisplayStyle
.swift */
;
};
965E81171DD4D5C800D61E4B
/* RootController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7991CB40DC500C806FE
/* RootController.swift */
;
};
965E81171DD4D5C800D61E4B
/* RootController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7991CB40DC500C806FE
/* RootController.swift */
;
};
965E81181DD4D5C800D61E4B
/* Snackbar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963FBEFC1D669510008F8512
/* Snackbar.swift */
;
};
965E81181DD4D5C800D61E4B
/* Snackbar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963FBEFC1D669510008F8512
/* Snackbar.swift */
;
};
965E81191DD4D5C800D61E4B
/* SnackbarController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961EFC571D738FF600E84652
/* SnackbarController.swift */
;
};
965E81191DD4D5C800D61E4B
/* SnackbarController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961EFC571D738FF600E84652
/* SnackbarController.swift */
;
};
...
@@ -190,7 +190,7 @@
...
@@ -190,7 +190,7 @@
/* End PBXBuildFile section */
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
9606CFAB1E957AC3006B4E74
/*
TabMenuController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Tab
MenuController.swift
;
sourceTree
=
"<group>"
;
};
9606CFAB1E957AC3006B4E74
/*
PageMenuController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Page
MenuController.swift
;
sourceTree
=
"<group>"
;
};
961276621DCD8B1800A7D920
/* CharacterAttribute.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CharacterAttribute.swift
;
sourceTree
=
"<group>"
;
};
961276621DCD8B1800A7D920
/* CharacterAttribute.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CharacterAttribute.swift
;
sourceTree
=
"<group>"
;
};
961730591E145DE900A9A297
/* CollectionViewCard.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CollectionViewCard.swift
;
sourceTree
=
"<group>"
;
};
961730591E145DE900A9A297
/* CollectionViewCard.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CollectionViewCard.swift
;
sourceTree
=
"<group>"
;
};
961E6BDE1DDA2A95004E6C93
/* Application.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Application.swift
;
sourceTree
=
"<group>"
;
};
961E6BDE1DDA2A95004E6C93
/* Application.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Application.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -198,7 +198,7 @@
...
@@ -198,7 +198,7 @@
961EFC571D738FF600E84652
/* SnackbarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SnackbarController.swift
;
sourceTree
=
"<group>"
;
};
961EFC571D738FF600E84652
/* SnackbarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SnackbarController.swift
;
sourceTree
=
"<group>"
;
};
961F18E71CD93E3E008927C5
/* ErrorTextField.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ErrorTextField.swift
;
sourceTree
=
"<group>"
;
};
961F18E71CD93E3E008927C5
/* ErrorTextField.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ErrorTextField.swift
;
sourceTree
=
"<group>"
;
};
96230AB71D6A520C00AF47DC
/* Divider.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Divider.swift
;
sourceTree
=
"<group>"
;
};
96230AB71D6A520C00AF47DC
/* Divider.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Divider.swift
;
sourceTree
=
"<group>"
;
};
9626CA961DAB53A8003E2611
/* Display
.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Display
.swift
;
sourceTree
=
"<group>"
;
};
9626CA961DAB53A8003E2611
/* Display
Style.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DisplayStyle
.swift
;
sourceTree
=
"<group>"
;
};
9626CB9A1DAD3D1D003E2611
/* HeightPreset.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
HeightPreset.swift
;
sourceTree
=
"<group>"
;
};
9626CB9A1DAD3D1D003E2611
/* HeightPreset.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
HeightPreset.swift
;
sourceTree
=
"<group>"
;
};
962864591D53FE3E00690B69
/* Material+UIWindow.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIWindow.swift"
;
sourceTree
=
"<group>"
;
};
962864591D53FE3E00690B69
/* Material+UIWindow.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIWindow.swift"
;
sourceTree
=
"<group>"
;
};
9628645E1D540AF300690B69
/* DynamicFontType.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DynamicFontType.swift
;
sourceTree
=
"<group>"
;
};
9628645E1D540AF300690B69
/* DynamicFontType.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DynamicFontType.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -350,7 +350,7 @@
...
@@ -350,7 +350,7 @@
9626CA951DAB5370003E2611
/* Root */
=
{
9626CA951DAB5370003E2611
/* Root */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
9626CA961DAB53A8003E2611
/* Display.swift */
,
9626CA961DAB53A8003E2611
/* Display
Style
.swift */
,
96BCB7991CB40DC500C806FE
/* RootController.swift */
,
96BCB7991CB40DC500C806FE
/* RootController.swift */
,
);
);
name
=
Root
;
name
=
Root
;
...
@@ -364,13 +364,13 @@
...
@@ -364,13 +364,13 @@
name
=
Height
;
name
=
Height
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
962DDD071D6FBBB7001C307C
/* TabMenu */
=
{
962DDD071D6FBBB7001C307C
/*
Page
TabMenu */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
963FBF071D669D14008F8512
/* PageTabBarController.swift */
,
963FBF071D669D14008F8512
/* PageTabBarController.swift */
,
9606CFAB1E957AC3006B4E74
/*
Tab
MenuController.swift */
,
9606CFAB1E957AC3006B4E74
/*
Page
MenuController.swift */
,
);
);
name
=
TabMenu
;
name
=
Page
TabMenu
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
962DDD081D6FBBD0001C307C
/* BottomTabBar */
=
{
962DDD081D6FBBD0001C307C
/* BottomTabBar */
=
{
...
@@ -530,7 +530,7 @@
...
@@ -530,7 +530,7 @@
96BCB8091CB4107700C806FE
/* Motion */
,
96BCB8091CB4107700C806FE
/* Motion */
,
96BCB8011CB40F1700C806FE
/* Navigation */
,
96BCB8011CB40F1700C806FE
/* Navigation */
,
961E6BEF1DDA4B04004E6C93
/* NavigationDrawer */
,
961E6BEF1DDA4B04004E6C93
/* NavigationDrawer */
,
962DDD071D6FBBB7001C307C
/* TabMenu */
,
962DDD071D6FBBB7001C307C
/*
Page
TabMenu */
,
96717B151DBE6B1800DA84DB
/* Photos */
,
96717B151DBE6B1800DA84DB
/* Photos */
,
96328B8F1E05B69A009A4C90
/* Reminders */
,
96328B8F1E05B69A009A4C90
/* Reminders */
,
9626CA951DAB5370003E2611
/* Root */
,
9626CA951DAB5370003E2611
/* Root */
,
...
@@ -820,7 +820,7 @@
...
@@ -820,7 +820,7 @@
9617B0871DFCA8CF00410F8F
/* PageTabBarController.swift in Headers */
,
9617B0871DFCA8CF00410F8F
/* PageTabBarController.swift in Headers */
,
9617B0881DFCA8CF00410F8F
/* PhotoLibrary.swift in Headers */
,
9617B0881DFCA8CF00410F8F
/* PhotoLibrary.swift in Headers */
,
9617B0891DFCA8CF00410F8F
/* PhotoLibraryController.swift in Headers */
,
9617B0891DFCA8CF00410F8F
/* PhotoLibraryController.swift in Headers */
,
9617B08A1DFCA8CF00410F8F
/* Display.swift in Headers */
,
9617B08A1DFCA8CF00410F8F
/* Display
Style
.swift in Headers */
,
9617B08B1DFCA8CF00410F8F
/* Screen.swift in Headers */
,
9617B08B1DFCA8CF00410F8F
/* Screen.swift in Headers */
,
9617B08C1DFCA8CF00410F8F
/* SearchBar.swift in Headers */
,
9617B08C1DFCA8CF00410F8F
/* SearchBar.swift in Headers */
,
9617B08D1DFCA8CF00410F8F
/* SearchBarController.swift in Headers */
,
9617B08D1DFCA8CF00410F8F
/* SearchBarController.swift in Headers */
,
...
@@ -943,7 +943,7 @@
...
@@ -943,7 +943,7 @@
965E81131DD4D5C800D61E4B
/* NavigationDrawerController.swift in Sources */
,
965E81131DD4D5C800D61E4B
/* NavigationDrawerController.swift in Sources */
,
965E81141DD4D5C800D61E4B
/* PhotoLibrary.swift in Sources */
,
965E81141DD4D5C800D61E4B
/* PhotoLibrary.swift in Sources */
,
965E81151DD4D5C800D61E4B
/* PhotoLibraryController.swift in Sources */
,
965E81151DD4D5C800D61E4B
/* PhotoLibraryController.swift in Sources */
,
965E81161DD4D5C800D61E4B
/* Display.swift in Sources */
,
965E81161DD4D5C800D61E4B
/* Display
Style
.swift in Sources */
,
965E81171DD4D5C800D61E4B
/* RootController.swift in Sources */
,
965E81171DD4D5C800D61E4B
/* RootController.swift in Sources */
,
965E81181DD4D5C800D61E4B
/* Snackbar.swift in Sources */
,
965E81181DD4D5C800D61E4B
/* Snackbar.swift in Sources */
,
96328B911E05B6B5009A4C90
/* Reminders.swift in Sources */
,
96328B911E05B6B5009A4C90
/* Reminders.swift in Sources */
,
...
@@ -995,7 +995,7 @@
...
@@ -995,7 +995,7 @@
965E80D81DD4C50600D61E4B
/* Layer.swift in Sources */
,
965E80D81DD4C50600D61E4B
/* Layer.swift in Sources */
,
965E80D91DD4C50600D61E4B
/* Layout.swift in Sources */
,
965E80D91DD4C50600D61E4B
/* Layout.swift in Sources */
,
965E80DA1DD4C50600D61E4B
/* Border.swift in Sources */
,
965E80DA1DD4C50600D61E4B
/* Border.swift in Sources */
,
9606CFAC1E957AC3006B4E74
/*
Tab
MenuController.swift in Sources */
,
9606CFAC1E957AC3006B4E74
/*
Page
MenuController.swift in Sources */
,
965E80DB1DD4C50600D61E4B
/* InterimSpace.swift in Sources */
,
965E80DB1DD4C50600D61E4B
/* InterimSpace.swift in Sources */
,
965E80DC1DD4C50600D61E4B
/* Depth.swift in Sources */
,
965E80DC1DD4C50600D61E4B
/* Depth.swift in Sources */
,
965E80DD1DD4C50600D61E4B
/* EdgeInsets.swift in Sources */
,
965E80DD1DD4C50600D61E4B
/* EdgeInsets.swift in Sources */
,
...
...
Sources/iOS/Bar.swift
View file @
58a5469c
...
@@ -39,7 +39,7 @@ public enum ContentViewAlignment: Int {
...
@@ -39,7 +39,7 @@ public enum ContentViewAlignment: Int {
open
class
Bar
:
View
{
open
class
Bar
:
View
{
/// Will layout the view.
/// Will layout the view.
open
var
willLayout
:
Bool
{
open
var
willLayout
:
Bool
{
return
0
<
width
&&
0
<
height
&&
nil
!=
superview
return
0
<
width
&&
0
<
height
&&
nil
!=
superview
&&
!
grid
.
deferred
}
}
open
override
var
intrinsicContentSize
:
CGSize
{
open
override
var
intrinsicContentSize
:
CGSize
{
...
@@ -105,7 +105,7 @@ open class Bar: View {
...
@@ -105,7 +105,7 @@ open class Bar: View {
}
}
/// ContentView that holds the any desired subviews.
/// ContentView that holds the any desired subviews.
open
let
contentView
=
UIView
()
open
let
contentView
=
UI
Scroll
View
()
/// Left side UIViews.
/// Left side UIViews.
open
var
leftViews
:
[
UIView
]
{
open
var
leftViews
:
[
UIView
]
{
...
@@ -183,15 +183,6 @@ open class Bar: View {
...
@@ -183,15 +183,6 @@ open class Bar: View {
return
return
}
}
guard
!
grid
.
deferred
else
{
return
}
reload
()
}
/// Reloads the view.
open
func
reload
()
{
var
lc
=
0
var
lc
=
0
var
rc
=
0
var
rc
=
0
...
@@ -281,5 +272,17 @@ open class Bar: View {
...
@@ -281,5 +272,17 @@ open class Bar: View {
autoresizingMask
=
.
flexibleWidth
autoresizingMask
=
.
flexibleWidth
interimSpacePreset
=
.
interimSpace3
interimSpacePreset
=
.
interimSpace3
contentEdgeInsetsPreset
=
.
square1
contentEdgeInsetsPreset
=
.
square1
prepareContentView
()
}
}
extension
Bar
{
/// Prepares the contentView.
fileprivate
func
prepareContentView
()
{
contentView
.
bounces
=
false
contentView
.
isPagingEnabled
=
true
contentView
.
showsVerticalScrollIndicator
=
false
contentView
.
showsHorizontalScrollIndicator
=
false
contentView
.
contentScaleFactor
=
Screen
.
scale
}
}
}
}
Sources/iOS/BottomNavigationController.swift
View file @
58a5469c
...
@@ -72,7 +72,12 @@ open class BottomNavigationController: UITabBarController {
...
@@ -72,7 +72,12 @@ open class BottomNavigationController: UITabBarController {
layoutSubviews
()
layoutSubviews
()
}
}
open
func
layoutSubviews
()
{
/**
To execute in the order of the layout chain, override this
method. `layoutSubviews` should be called immediately, unless you
have a certain need.
*/
open
func
layoutSubviews
()
{
if
let
v
=
tabBar
.
items
{
if
let
v
=
tabBar
.
items
{
for
item
in
v
{
for
item
in
v
{
if
.
phone
==
Device
.
userInterfaceIdiom
{
if
.
phone
==
Device
.
userInterfaceIdiom
{
...
...
Sources/iOS/Capture/CaptureController.swift
View file @
58a5469c
...
@@ -71,7 +71,7 @@ open class CaptureController: ToolbarController {
...
@@ -71,7 +71,7 @@ open class CaptureController: ToolbarController {
*/
*/
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
toolbarDisplay
=
.
full
displayStyle
=
.
full
view
.
backgroundColor
=
.
black
view
.
backgroundColor
=
.
black
prepareStatusBar
()
prepareStatusBar
()
...
...
Sources/iOS/CollectionViewCard.swift
View file @
58a5469c
...
@@ -53,19 +53,7 @@ open class CollectionViewCard: Card {
...
@@ -53,19 +53,7 @@ open class CollectionViewCard: Card {
@IBInspectable
@IBInspectable
open
let
collectionView
=
CollectionView
()
open
let
collectionView
=
CollectionView
()
open
override
func
layoutSubviews
()
{
/// Reloads the view.
super
.
layoutSubviews
()
reload
()
}
open
override
func
prepare
()
{
super
.
prepare
()
pulseAnimation
=
.
none
prepareCollectionView
()
prepareContentView
()
}
open
override
func
reload
()
{
open
override
func
reload
()
{
if
0
==
collectionView
.
height
{
if
0
==
collectionView
.
height
{
var
h
:
CGFloat
=
0
var
h
:
CGFloat
=
0
...
@@ -79,7 +67,22 @@ open class CollectionViewCard: Card {
...
@@ -79,7 +67,22 @@ open class CollectionViewCard: Card {
collectionView
.
reloadData
()
collectionView
.
reloadData
()
super
.
reload
()
super
.
layoutSubviews
()
}
/**
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
()
pulseAnimation
=
.
none
prepareCollectionView
()
prepareContentView
()
}
}
}
}
...
...
Sources/iOS/Display.swift
→
Sources/iOS/Display
Style
.swift
View file @
58a5469c
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
import
UIKit
import
UIKit
@objc(Display)
@objc(Display
Style
)
public
enum
Display
:
Int
{
public
enum
Display
Style
:
Int
{
case
partial
case
partial
case
full
case
full
}
}
Sources/iOS/ImageCard.swift
View file @
58a5469c
...
@@ -42,7 +42,7 @@ open class ImageCard: Card {
...
@@ -42,7 +42,7 @@ open class ImageCard: Card {
display the imageView to the full view
display the imageView to the full view
bounds.
bounds.
*/
*/
open
var
imageViewDisplay
=
Display
.
partial
{
open
var
displayStyle
=
DisplayStyle
.
partial
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
...
@@ -82,6 +82,7 @@ open class ImageCard: Card {
...
@@ -82,6 +82,7 @@ open class ImageCard: Card {
}
}
}
}
/// Reloads the view.
open
override
func
reload
()
{
open
override
func
reload
()
{
var
h
:
CGFloat
=
0
var
h
:
CGFloat
=
0
...
...
Sources/iOS/Material+Motion.swift
View file @
58a5469c
...
@@ -95,7 +95,8 @@ fileprivate struct MotionInstance {
...
@@ -95,7 +95,8 @@ fileprivate struct MotionInstance {
}
}
fileprivate
struct
MotionInstanceController
{
fileprivate
struct
MotionInstanceController
{
fileprivate
var
isEnabled
:
Bool
fileprivate
var
isMotionEnabled
:
Bool
fileprivate
var
isInteractiveMotionEnabled
:
Bool
fileprivate
weak
var
delegate
:
MotionDelegate
?
fileprivate
weak
var
delegate
:
MotionDelegate
?
}
}
...
@@ -104,7 +105,7 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
...
@@ -104,7 +105,7 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
fileprivate
var
motionInstanceController
:
MotionInstanceController
{
fileprivate
var
motionInstanceController
:
MotionInstanceController
{
get
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
MotionInstanceControllerKey
)
{
return
AssociatedObject
(
base
:
self
,
key
:
&
MotionInstanceControllerKey
)
{
return
MotionInstanceController
(
isEnabled
:
false
,
delegate
:
nil
)
return
MotionInstanceController
(
is
MotionEnabled
:
false
,
isInteractiveMotion
Enabled
:
false
,
delegate
:
nil
)
}
}
}
}
set
(
value
)
{
set
(
value
)
{
...
@@ -115,18 +116,29 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
...
@@ -115,18 +116,29 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
/// A boolean that indicates whether motion is enabled.
/// A boolean that indicates whether motion is enabled.
open
var
isMotionEnabled
:
Bool
{
open
var
isMotionEnabled
:
Bool
{
get
{
get
{
return
motionInstanceController
.
isEnabled
return
motionInstanceController
.
is
Motion
Enabled
}
}
set
(
value
)
{
set
(
value
)
{
if
value
{
if
value
{
modalPresentationStyle
=
.
custom
prepareMotionDelegation
()
transitioningDelegate
=
self
motionDelegate
=
self
(
self
as?
UINavigationController
)?
.
delegate
=
self
(
self
as?
UITabBarController
)?
.
delegate
=
self
}
}
motionInstanceController
.
isEnabled
=
value
motionInstanceController
.
isMotionEnabled
=
value
}
}
/// A boolean that indicates whether interactive motion is enabled.
open
var
isInteractiveMotionEnabled
:
Bool
{
get
{
return
motionInstanceController
.
isInteractiveMotionEnabled
}
set
(
value
)
{
if
value
{
prepareMotionDelegation
()
motionInstanceController
.
isMotionEnabled
=
true
}
motionInstanceController
.
isInteractiveMotionEnabled
=
value
}
}
}
}
...
@@ -139,28 +151,16 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
...
@@ -139,28 +151,16 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
motionInstanceController
.
delegate
=
value
motionInstanceController
.
delegate
=
value
}
}
}
}
}
/**
Determines whether to use a Motion instance for transitions.
extension
UIViewController
{
- Parameter _ navigationController: A UINavigationController.
/// Prepares the motionDelegate.
- Parameter animationControllerFor operation: A UINavigationControllerOperation.
fileprivate
func
prepareMotionDelegation
()
{
- Parameter from fromVC: A UIViewController that is being transitioned from.
modalPresentationStyle
=
.
custom
- Parameter to toVC: A UIViewController that is being transitioned to.
transitioningDelegate
=
self
- Returns: An optional UIViewControllerAnimatedTransitioning.
motionDelegate
=
self
*/
(
self
as?
UINavigationController
)?
.
delegate
=
self
open
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
(
self
as?
UITabBarController
)?
.
delegate
=
self
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
operation
==
.
push
,
isContainer
:
true
)
:
nil
}
/**
Determines whether to use a Motion instance for transitions.
- Parameter _ tabBarController: A UITabBarController.
- Parameter animationControllerForTransitionFrom fromVC: A UIViewController that is being transitioned from.
- Parameter to toVC: A UIViewController that is being transitioned to.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
true
,
isContainer
:
true
)
:
nil
}
}
}
}
...
@@ -173,7 +173,8 @@ extension UIViewController {
...
@@ -173,7 +173,8 @@ extension UIViewController {
- Returns: An optional UIViewControllerAnimatedTransitioning.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
*/
open
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
open
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
isMotionEnabled
?
PresentingMotion
(
isPresenting
:
true
,
isContainer
:
false
)
:
nil
print
(
"animationController(forPresented"
)
return
isMotionEnabled
?
PresentingMotion
(
isPresenting
:
true
)
:
nil
}
}
/**
/**
...
@@ -182,7 +183,8 @@ extension UIViewController {
...
@@ -182,7 +183,8 @@ extension UIViewController {
- Returns: An optional UIViewControllerAnimatedTransitioning.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
*/
open
func
animationController
(
forDismissed
dismissed
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
open
func
animationController
(
forDismissed
dismissed
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
isMotionEnabled
?
DismissingMotion
(
isPresenting
:
true
,
isContainer
:
false
)
:
nil
print
(
"animationController(forDismissed"
)
return
isMotionEnabled
?
DismissingMotion
(
isPresenting
:
true
)
:
nil
}
}
/**
/**
...
@@ -193,8 +195,46 @@ extension UIViewController {
...
@@ -193,8 +195,46 @@ extension UIViewController {
- Returns: An optional UIPresentationController.
- Returns: An optional UIPresentationController.
*/
*/
open
func
presentationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
?,
source
:
UIViewController
)
->
UIPresentationController
?
{
open
func
presentationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
?,
source
:
UIViewController
)
->
UIPresentationController
?
{
print
(
"presentationController:forPresented"
)
return
isMotionEnabled
?
MotionPresentationController
(
presentedViewController
:
presented
,
presenting
:
presenting
)
:
nil
return
isMotionEnabled
?
MotionPresentationController
(
presentedViewController
:
presented
,
presenting
:
presenting
)
:
nil
}
}
open
func
interactionControllerForPresentation
(
using
animator
:
UIViewControllerAnimatedTransitioning
)
->
UIViewControllerInteractiveTransitioning
?
{
print
(
"interactionControllerForPresentation"
)
return
isInteractiveMotionEnabled
?
InteractivePresentingMotion
(
animator
:
animator
)
:
nil
}
open
func
interactionControllerForDismissal
(
using
animator
:
UIViewControllerAnimatedTransitioning
)
->
UIViewControllerInteractiveTransitioning
?
{
print
(
"interactionControllerForDismissal"
)
return
isInteractiveMotionEnabled
?
InteractiveDismissingMotion
(
animator
:
animator
)
:
nil
}
}
extension
UIViewController
{
/**
Determines whether to use a Motion instance for transitions.
- Parameter _ navigationController: A UINavigationController.
- Parameter animationControllerFor operation: A UINavigationControllerOperation.
- Parameter from fromVC: A UIViewController that is being transitioned from.
- Parameter to toVC: A UIViewController that is being transitioned to.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"navigationController(_ navigationController"
)
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
operation
==
.
push
)
:
nil
}
/**
Determines whether to use a Motion instance for transitions.
- Parameter _ tabBarController: A UITabBarController.
- Parameter animationControllerForTransitionFrom fromVC: A UIViewController that is being transitioned from.
- Parameter to toVC: A UIViewController that is being transitioned to.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"tabBarController(_ tabBarController"
)
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
true
)
:
nil
}
}
}
extension
UIView
{
extension
UIView
{
...
@@ -348,9 +388,6 @@ open class MotionAnimator: NSObject {
...
@@ -348,9 +388,6 @@ open class MotionAnimator: NSObject {
/// A boolean indicating whether Motion is presenting a view controller.
/// A boolean indicating whether Motion is presenting a view controller.
open
fileprivate
(
set
)
var
isPresenting
:
Bool
open
fileprivate
(
set
)
var
isPresenting
:
Bool
/// A boolean indicating whether the view controller is a container.
open
fileprivate
(
set
)
var
isContainer
:
Bool
/**
/**
An Array of UIView pairs with common motionIdentifiers in
An Array of UIView pairs with common motionIdentifiers in
the from and to view controllers.
the from and to view controllers.
...
@@ -374,19 +411,19 @@ open class MotionAnimator: NSObject {
...
@@ -374,19 +411,19 @@ open class MotionAnimator: NSObject {
}
}
/// The transition context for the current transition.
/// The transition context for the current transition.
open
var
transitionContext
:
UIViewControllerContextTransitioning
!
open
fileprivate
(
set
)
var
transitionContext
:
UIViewControllerContextTransitioning
!
/// The transition delay time.
/// The transition delay time.
open
var
delay
:
TimeInterval
=
0
open
fileprivate
(
set
)
var
delay
:
TimeInterval
=
0
/// The transition duration time.
/// The transition duration time.
open
var
duration
:
TimeInterval
=
0.35
open
fileprivate
(
set
)
var
duration
:
TimeInterval
=
0.35
/// The transition container view.
/// The transition container view.
open
var
containerView
:
UIView
!
open
fileprivate
(
set
)
var
containerView
:
UIView
!
/// The view that is used to animate the transitions between view controllers.
/// The view that is used to animate the transitions between view controllers.
open
var
transitionView
=
UIView
()
open
fileprivate
(
set
)
var
transitionView
=
UIView
()
/// The view that is being transitioned to.
/// The view that is being transitioned to.
open
var
toView
:
UIView
{
open
var
toView
:
UIView
{
...
@@ -411,7 +448,6 @@ open class MotionAnimator: NSObject {
...
@@ -411,7 +448,6 @@ open class MotionAnimator: NSObject {
/// The default initializer.
/// The default initializer.
public
override
init
()
{
public
override
init
()
{
isPresenting
=
false
isPresenting
=
false
isContainer
=
false
super
.
init
()
super
.
init
()
}
}
...
@@ -419,12 +455,9 @@ open class MotionAnimator: NSObject {
...
@@ -419,12 +455,9 @@ open class MotionAnimator: NSObject {
An initializer to modify the presenting and container state.
An initializer to modify the presenting and container state.
- Parameter isPresenting: A boolean value indicating if the
- Parameter isPresenting: A boolean value indicating if the
Motion instance is presenting the view controller.
Motion instance is presenting the view controller.
- Parameter isContainer: A boolean value indicating if the
Motion instance is a container view controller.
*/
*/
public
init
(
isPresenting
:
Bool
,
isContainer
:
Bool
)
{
public
init
(
isPresenting
:
Bool
)
{
self
.
isPresenting
=
isPresenting
self
.
isPresenting
=
isPresenting
self
.
isContainer
=
isContainer
super
.
init
()
super
.
init
()
}
}
...
@@ -835,5 +868,101 @@ open class DismissingMotion: Motion {
...
@@ -835,5 +868,101 @@ open class DismissingMotion: Motion {
toView
.
setNeedsLayout
()
toView
.
setNeedsLayout
()
toView
.
layoutIfNeeded
()
toView
.
layoutIfNeeded
()
}
}
}
open
class
InteractiveMotion
:
UIPercentDrivenInteractiveTransition
{
/// A reference to the view controller that is being transitioned to.
open
var
toViewController
:
UIViewController
{
return
transitionContext
.
viewController
(
forKey
:
.
to
)
!
}
/// A reference to the view controller that is being transitioned from.
open
var
fromViewController
:
UIViewController
{
return
transitionContext
.
viewController
(
forKey
:
.
from
)
!
}
/// The transition context for the current transition.
open
fileprivate
(
set
)
var
transitionContext
:
UIViewControllerContextTransitioning
!
/// A reference to the panGesture for transitions.
open
fileprivate
(
set
)
var
panGesture
:
UIPanGestureRecognizer
!
/// The transition container view.
open
fileprivate
(
set
)
var
containerView
:
UIView
!
open
fileprivate
(
set
)
var
animator
:
UIViewControllerAnimatedTransitioning
!
/**
An initializer that accepts an animator object.
- Parameter animator: UIViewControllerAnimatedTransitioning.
*/
public
init
(
animator
:
UIViewControllerAnimatedTransitioning
)
{
super
.
init
()
self
.
animator
=
animator
}
open
override
func
startInteractiveTransition
(
_
transitionContext
:
UIViewControllerContextTransitioning
)
{
super
.
startInteractiveTransition
(
transitionContext
)
self
.
transitionContext
=
transitionContext
preparePanGesture
()
prepareContainerView
()
}
//
//
// optional public var completionSpeed: CGFloat { get }
//
// optional public var completionCurve: UIViewAnimationCurve { get }
//
//
// /// In 10.0, if an object conforming to UIViewControllerAnimatedTransitioning is
// /// known to be interruptible, it is possible to start it as if it was not
// /// interactive and then interrupt the transition and interact with it. In this
// /// case, implement this method and return NO. If an interactor does not
// /// implement this method, YES is assumed.
// @available(iOS 10.0, *)
// optional public var wantsInteractiveStart: Bool { get }
}
extension
InteractiveMotion
{
fileprivate
func
preparePanGesture
()
{
panGesture
=
UIPanGestureRecognizer
(
target
:
self
,
action
:
#selector(
handlePanUpdate(gestureRecognizer:)
)
)
panGesture
.
maximumNumberOfTouches
=
1
}
/// Prepares the containerView.
fileprivate
func
prepareContainerView
()
{
containerView
=
transitionContext
.
containerView
containerView
.
addGestureRecognizer
(
panGesture
)
}
}
extension
InteractiveMotion
{
@objc
fileprivate
func
handlePanUpdate
(
gestureRecognizer
:
UIGestureRecognizer
)
{
switch
gestureRecognizer
.
state
{
case
.
began
:
panGesture
.
setTranslation
(
.
zero
,
in
:
containerView
)
print
(
"began"
)
case
.
changed
:
let
translation
=
panGesture
.
translation
(
in
:
containerView
)
let
percentage
=
fabs
(
translation
.
y
/
containerView
.
bounds
.
height
)
update
(
percentage
)
print
(
"changed"
,
percentage
)
case
.
ended
:
finish
()
containerView
.
removeGestureRecognizer
(
panGesture
)
print
(
"ended"
)
default
:
break
}
}
}
open
class
InteractivePresentingMotion
:
InteractiveMotion
{
}
open
class
InteractiveDismissingMotion
:
InteractiveMotion
{
}
}
Sources/iOS/PageMenuController.swift
0 → 100644
View file @
58a5469c
/*
* Copyright (C) 2015 - 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
/// A memory reference to the PageMenuBarItem instance for UIViewController extensions.
fileprivate
var
PageMenuBarItemKey
:
UInt8
=
0
open
class
PageMenuBarItem
:
FlatButton
{
open
override
func
prepare
()
{
super
.
prepare
()
pulseAnimation
=
.
none
}
}
@objc(TabBarAlignment)
public
enum
TabBarAlignment
:
Int
{
case
top
case
bottom
case
hidden
}
extension
UIViewController
{
/// pageMenuBarItem reference.
public
private(set)
var
pageMenuBarItem
:
PageMenuBarItem
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
PageMenuBarItemKey
)
{
return
PageMenuBarItem
()
}
}
set
(
value
)
{
AssociateObject
(
base
:
self
,
key
:
&
PageMenuBarItemKey
,
value
:
value
)
}
}
}
extension
UIViewController
{
/**
A convenience property that provides access to the PageMenuController.
This is the recommended method of accessing the PageMenuController
through child UIViewControllers.
*/
public
var
pageMenuController
:
PageMenuController
?
{
var
viewController
:
UIViewController
?
=
self
while
nil
!=
viewController
{
if
viewController
is
PageMenuController
{
return
viewController
as?
PageMenuController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
open
class
PageMenuController
:
UIViewController
{
/// A reference to the currently selected view controller index value.
@IBInspectable
open
var
selectedIndex
=
0
/// Enables and disables bouncing when swiping.
open
var
isBounceEnabled
:
Bool
{
get
{
return
scrollView
.
bounces
}
set
(
value
)
{
scrollView
.
bounces
=
value
}
}
/// The TabBar used to switch between view controllers.
@IBInspectable
open
fileprivate
(
set
)
var
tabBar
:
TabBar
?
/// The UIScrollView used to pan the application pages.
@IBInspectable
open
let
scrollView
=
UIScrollView
()
/// An Array of UIViewControllers.
open
var
viewControllers
:
[
UIViewController
]
{
didSet
{
oldValue
.
forEach
{
[
weak
self
]
in
self
?
.
removeViewController
(
viewController
:
$0
)
}
prepareViewControllers
()
layoutSubviews
()
}
}
open
var
tabBarAlignment
=
TabBarAlignment
.
bottom
{
didSet
{
layoutSubviews
()
}
}
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
viewControllers
=
[]
super
.
init
(
coder
:
aDecoder
)
}
/// Previous scroll view content offset.
fileprivate
var
previousContentOffset
:
CGFloat
=
0
/// The number of views used in the scrollViewPool.
fileprivate
let
viewPoolCount
=
3
/**
An initializer that accepts an Array of UIViewControllers.
- Parameter viewControllers: An Array of UIViewControllers.
*/
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
:
Int
=
0
)
{
self
.
viewControllers
=
viewControllers
self
.
selectedIndex
=
selectedIndex
super
.
init
(
nibName
:
nil
,
bundle
:
nil
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepare
()
}
open
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
layoutSubviews
()
}
/**
To execute in the order of the layout chain, override this
method. `layoutSubviews` should be called immediately, unless you
have a certain need.
*/
open
func
layoutSubviews
()
{
layoutScrollView
()
layoutViewControllers
()
let
p
=
(
tabBar
?
.
intrinsicContentSize
.
height
??
0
)
+
(
tabBar
?
.
layoutEdgeInsets
.
top
??
0
)
+
(
tabBar
?
.
layoutEdgeInsets
.
bottom
??
0
)
let
y
=
view
.
height
-
p
tabBar
?
.
height
=
p
tabBar
?
.
width
=
view
.
width
+
(
tabBar
?
.
layoutEdgeInsets
.
left
??
0
)
+
(
tabBar
?
.
layoutEdgeInsets
.
right
??
0
)
switch
tabBarAlignment
{
case
.
top
:
tabBar
?
.
isHidden
=
false
tabBar
?
.
y
=
0
scrollView
.
y
=
p
scrollView
.
height
=
y
case
.
bottom
:
tabBar
?
.
isHidden
=
false
tabBar
?
.
y
=
y
scrollView
.
y
=
0
scrollView
.
height
=
y
case
.
hidden
:
tabBar
?
.
isHidden
=
true
scrollView
.
y
=
0
scrollView
.
height
=
view
.
height
}
}
/**
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
func
prepare
()
{
view
.
contentScaleFactor
=
Screen
.
scale
prepareScrollView
()
prepareViewControllers
()
}
}
extension
PageMenuController
{
/// Prepares the scrollView used to pan through view controllers.
fileprivate
func
prepareScrollView
()
{
scrollView
.
delegate
=
self
scrollView
.
bounces
=
false
scrollView
.
isPagingEnabled
=
true
scrollView
.
showsVerticalScrollIndicator
=
false
scrollView
.
showsHorizontalScrollIndicator
=
false
scrollView
.
contentScaleFactor
=
Screen
.
scale
view
.
addSubview
(
scrollView
)
}
/// Prepares the view controllers.
fileprivate
func
prepareViewControllers
()
{
let
n
=
viewControllers
.
count
guard
1
<
n
else
{
if
1
==
n
{
prepareViewController
(
at
:
0
)
}
return
}
let
m
=
viewPoolCount
<
n
?
viewPoolCount
:
n
if
0
==
selectedIndex
{
for
i
in
0
..<
m
{
prepareViewController
(
at
:
i
)
}
}
else
if
n
-
1
==
selectedIndex
{
for
i
in
0
..<
m
{
prepareViewController
(
at
:
selectedIndex
-
i
)
}
}
else
{
prepareViewController
(
at
:
selectedIndex
)
prepareViewController
(
at
:
selectedIndex
-
1
)
prepareViewController
(
at
:
selectedIndex
+
1
)
}
prepareTabBar
()
}
/**
Prepares the tabBar buttons.
- Parameter _ buttons: An Array of UIButtons.
*/
fileprivate
func
prepareTabBarButtons
(
_
buttons
:
[
UIButton
])
{
guard
let
tb
=
tabBar
else
{
return
}
tb
.
buttons
=
buttons
for
v
in
tb
.
buttons
{
v
.
removeTarget
(
self
,
action
:
#selector(
tb.handleButton(button:)
)
,
for
:
.
touchUpInside
)
v
.
removeTarget
(
self
,
action
:
#selector(
handleTabBarButton(button:)
)
,
for
:
.
touchUpInside
)
v
.
addTarget
(
self
,
action
:
#selector(
handleTabBarButton(button:)
)
,
for
:
.
touchUpInside
)
}
}
fileprivate
func
prepareTabBar
()
{
guard
0
<
viewControllers
.
count
else
{
tabBar
=
nil
return
}
var
buttons
=
[
UIButton
]()
for
v
in
viewControllers
{
let
button
=
v
.
pageMenuBarItem
as
UIButton
buttons
.
append
(
button
)
}
guard
0
<
buttons
.
count
else
{
tabBar
=
nil
return
}
guard
nil
==
tabBar
else
{
prepareTabBarButtons
(
buttons
)
return
}
tabBar
=
TabBar
()
tabBar
?
.
isLineAnimated
=
false
tabBar
?
.
lineAlignment
=
.
top
view
.
addSubview
(
tabBar
!
)
prepareTabBarButtons
(
buttons
)
}
/**
Loads a view controller based on its index in the viewControllers Array
and adds it as a child view controller.
- Parameter at index: An Int for the viewControllers index.
*/
fileprivate
func
prepareViewController
(
at
index
:
Int
)
{
let
vc
=
viewControllers
[
index
]
guard
!
childViewControllers
.
contains
(
vc
)
else
{
return
}
addChildViewController
(
vc
)
vc
.
didMove
(
toParentViewController
:
self
)
vc
.
view
.
clipsToBounds
=
true
vc
.
view
.
contentScaleFactor
=
Screen
.
scale
scrollView
.
addSubview
(
vc
.
view
)
}
}
extension
PageMenuController
{
fileprivate
func
layoutScrollView
()
{
scrollView
.
frame
=
view
.
bounds
scrollView
.
contentSize
=
CGSize
(
width
:
scrollView
.
width
*
CGFloat
(
viewControllers
.
count
),
height
:
scrollView
.
height
)
scrollView
.
contentOffset
=
CGPoint
(
x
:
scrollView
.
width
*
CGFloat
(
selectedIndex
),
y
:
0
)
}
fileprivate
func
layoutViewControllers
()
{
let
n
=
viewControllers
.
count
scrollView
.
contentSize
=
CGSize
(
width
:
scrollView
.
width
*
CGFloat
(
n
),
height
:
scrollView
.
height
)
guard
1
<
n
else
{
layoutViewController
(
at
:
0
,
position
:
0
)
return
}
let
m
=
viewPoolCount
<
n
?
viewPoolCount
:
n
if
0
==
selectedIndex
{
for
i
in
0
..<
m
{
layoutViewController
(
at
:
i
,
position
:
i
)
}
}
else
if
n
-
1
==
selectedIndex
{
var
q
=
0
for
i
in
0
..<
m
{
q
=
selectedIndex
-
i
layoutViewController
(
at
:
q
,
position
:
q
)
}
}
else
{
layoutViewController
(
at
:
selectedIndex
,
position
:
selectedIndex
)
layoutViewController
(
at
:
selectedIndex
-
1
,
position
:
selectedIndex
-
1
)
layoutViewController
(
at
:
selectedIndex
+
1
,
position
:
selectedIndex
+
1
)
}
}
/**
Positions a view controller within the scrollView.
- Parameter position: An Int for the position of the view controller.
*/
fileprivate
func
layoutViewController
(
at
index
:
Int
,
position
:
Int
)
{
viewControllers
[
index
]
.
view
.
frame
=
CGRect
(
x
:
CGFloat
(
position
)
*
scrollView
.
width
,
y
:
0
,
width
:
scrollView
.
width
,
height
:
scrollView
.
height
)
}
}
extension
PageMenuController
{
/// Removes the view controllers not within the scrollView.
fileprivate
func
removeViewControllers
()
{
let
n
=
viewControllers
.
count
guard
1
<
n
else
{
return
}
if
0
==
selectedIndex
{
for
i
in
1
..<
n
{
removeViewController
(
at
:
i
)
}
}
else
if
n
-
1
==
selectedIndex
{
for
i
in
0
..<
n
-
2
{
removeViewController
(
at
:
i
)
}
}
else
{
for
i
in
0
..<
selectedIndex
{
removeViewController
(
at
:
i
)
}
let
x
=
selectedIndex
+
1
if
x
<
n
{
for
i
in
x
..<
n
{
removeViewController
(
at
:
i
)
}
}
}
}
/**
Removes the view controller as a child view controller with
the given index.
- Parameter at index: An Int for the view controller position.
*/
fileprivate
func
removeViewController
(
at
index
:
Int
)
{
let
vc
=
viewControllers
[
index
]
guard
childViewControllers
.
contains
(
vc
)
else
{
return
}
removeViewController
(
viewController
:
vc
)
}
/**
Removes a given view controller from the childViewControllers array.
- Parameter at index: An Int for the view controller position.
*/
fileprivate
func
removeViewController
(
viewController
:
UIViewController
)
{
viewController
.
willMove
(
toParentViewController
:
nil
)
viewController
.
view
.
removeFromSuperview
()
viewController
.
removeFromParentViewController
()
}
}
extension
PageMenuController
{
/**
Handles the pageTabBarButton.
- Parameter button: A UIButton.
*/
@objc
fileprivate
func
handleTabBarButton
(
button
:
UIButton
)
{
guard
let
tb
=
tabBar
else
{
return
}
guard
let
i
=
tb
.
buttons
.
index
(
of
:
button
)
else
{
return
}
guard
i
!=
selectedIndex
else
{
return
}
selectedIndex
=
i
removeViewControllers
()
prepareViewControllers
()
layoutViewControllers
()
}
}
extension
PageMenuController
:
UIScrollViewDelegate
{
@objc
open
func
scrollViewDidEndDecelerating
(
_
scrollView
:
UIScrollView
)
{
let
w
=
scrollView
.
width
let
p
=
Int
(
floor
((
scrollView
.
contentOffset
.
x
-
w
/
2
)
/
w
)
+
1
)
selectedIndex
=
p
removeViewControllers
()
prepareViewControllers
()
layoutViewControllers
()
}
}
Sources/iOS/PageTabBarController.swift
View file @
58a5469c
...
@@ -97,7 +97,6 @@ public protocol PageTabBarControllerDelegate {
...
@@ -97,7 +97,6 @@ public protocol PageTabBarControllerDelegate {
optional
func
pageTabBarController
(
pageTabBarController
:
PageTabBarController
,
didTransitionTo
viewController
:
UIViewController
)
optional
func
pageTabBarController
(
pageTabBarController
:
PageTabBarController
,
didTransitionTo
viewController
:
UIViewController
)
}
}
@objc(PageTabBarController)
open
class
PageTabBarController
:
RootController
{
open
class
PageTabBarController
:
RootController
{
/// Reference to the PageTabBar.
/// Reference to the PageTabBar.
@IBInspectable
@IBInspectable
...
...
Sources/iOS/SearchBarController.swift
View file @
58a5469c
...
@@ -49,17 +49,6 @@ extension UIViewController {
...
@@ -49,17 +49,6 @@ extension UIViewController {
}
}
open
class
SearchBarController
:
StatusBarController
{
open
class
SearchBarController
:
StatusBarController
{
/**
A Display value to indicate whether or not to
display the rootViewController to the full view
bounds, or up to the searchBar height.
*/
open
var
searchBarDisplay
=
Display
.
partial
{
didSet
{
layoutSubviews
()
}
}
/// Reference to the SearchBar.
/// Reference to the SearchBar.
@IBInspectable
@IBInspectable
open
let
searchBar
=
SearchBar
()
open
let
searchBar
=
SearchBar
()
...
@@ -72,7 +61,7 @@ open class SearchBarController: StatusBarController {
...
@@ -72,7 +61,7 @@ open class SearchBarController: StatusBarController {
searchBar
.
y
=
y
searchBar
.
y
=
y
searchBar
.
width
=
view
.
width
searchBar
.
width
=
view
.
width
switch
searchBarDisplay
{
switch
displayStyle
{
case
.
partial
:
case
.
partial
:
let
h
=
y
+
searchBar
.
height
let
h
=
y
+
searchBar
.
height
rootViewController
.
view
.
y
=
h
rootViewController
.
view
.
y
=
h
...
@@ -91,6 +80,7 @@ open class SearchBarController: StatusBarController {
...
@@ -91,6 +80,7 @@ open class SearchBarController: StatusBarController {
*/
*/
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
displayStyle
=
.
partial
prepareStatusBar
()
prepareStatusBar
()
prepareSearchBar
()
prepareSearchBar
()
}
}
...
...
Sources/iOS/Snackbar.swift
View file @
58a5469c
...
@@ -70,9 +70,11 @@ open class Snackbar: Bar {
...
@@ -70,9 +70,11 @@ open class Snackbar: Bar {
return
super
.
hitTest
(
point
,
with
:
event
)
return
super
.
hitTest
(
point
,
with
:
event
)
}
}
/// Reloads the view.
open
override
func
layoutSubviews
()
{
open
override
func
reload
()
{
super
.
layoutSubviews
()
super
.
reload
()
guard
willLayout
else
{
return
}
centerViews
=
[
textLabel
]
centerViews
=
[
textLabel
]
}
}
...
...
Sources/iOS/StatusBarController.swift
View file @
58a5469c
...
@@ -54,7 +54,7 @@ open class StatusBarController: RootController {
...
@@ -54,7 +54,7 @@ open class StatusBarController: RootController {
display the rootViewController to the full view
display the rootViewController to the full view
bounds, or up to the toolbar height.
bounds, or up to the toolbar height.
*/
*/
open
var
statusBarDisplay
=
Display
.
full
{
open
var
displayStyle
=
DisplayStyle
.
full
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
...
@@ -100,7 +100,7 @@ open class StatusBarController: RootController {
...
@@ -100,7 +100,7 @@ open class StatusBarController: RootController {
statusBar
.
width
=
view
.
width
statusBar
.
width
=
view
.
width
switch
statusBarDisplay
{
switch
displayStyle
{
case
.
partial
:
case
.
partial
:
let
h
=
statusBar
.
height
let
h
=
statusBar
.
height
rootViewController
.
view
.
y
=
h
rootViewController
.
view
.
y
=
h
...
...
Sources/iOS/TabBar.swift
View file @
58a5469c
...
@@ -57,10 +57,33 @@ public protocol TabBarDelegate {
...
@@ -57,10 +57,33 @@ public protocol TabBarDelegate {
optional
func
tabBar
(
tabBar
:
TabBar
,
didSelect
button
:
UIButton
)
optional
func
tabBar
(
tabBar
:
TabBar
,
didSelect
button
:
UIButton
)
}
}
@objc(TabBarStyle)
public
enum
TabBarStyle
:
Int
{
case
normal
case
scrollable
}
open
class
TabBar
:
Bar
{
open
class
TabBar
:
Bar
{
/// A boolean indicating if the TabBar line is in an animation state.
/// A boolean indicating if the TabBar line is in an animation state.
open
internal(set)
var
isAnimating
=
false
open
internal(set)
var
isAnimating
=
false
/// Enables and disables bouncing when swiping.
open
var
isBounceEnabled
:
Bool
{
get
{
return
contentView
.
bounces
}
set
(
value
)
{
contentView
.
bounces
=
value
}
}
/// An enum that determines the tab bar style.
open
var
tabBarStyle
=
TabBarStyle
.
scrollable
{
didSet
{
layoutSubviews
()
}
}
/// A delegation reference.
/// A delegation reference.
open
weak
var
delegate
:
TabBarDelegate
?
open
weak
var
delegate
:
TabBarDelegate
?
...
@@ -116,8 +139,6 @@ open class TabBar: Bar {
...
@@ -116,8 +139,6 @@ open class TabBar: Bar {
b
.
removeFromSuperview
()
b
.
removeFromSuperview
()
}
}
centerViews
=
buttons
as
[
UIView
]
layoutSubviews
()
layoutSubviews
()
}
}
}
}
...
@@ -186,9 +207,26 @@ open class TabBar: Bar {
...
@@ -186,9 +207,26 @@ open class TabBar: Bar {
}
}
}
}
contentView
.
grid
.
axis
.
columns
=
buttons
.
count
if
.
scrollable
==
tabBarStyle
{
contentView
.
grid
.
reload
()
var
w
:
CGFloat
=
0
for
b
in
buttons
{
let
width
=
b
.
sizeThatFits
(
CGSize
(
width
:
CGFloat
.
greatestFiniteMagnitude
,
height
:
contentView
.
height
))
.
width
+
interimSpace
contentView
.
addSubview
(
b
)
b
.
height
=
contentView
.
height
b
.
width
=
width
b
.
x
=
w
w
+=
width
}
print
(
w
,
contentView
.
width
)
if
w
>
contentView
.
width
{
contentView
.
contentSize
.
width
=
w
}
}
else
{
contentView
.
grid
.
axis
.
columns
=
buttons
.
count
centerViews
=
buttons
}
if
nil
==
selected
{
if
nil
==
selected
{
selected
=
buttons
.
first
selected
=
buttons
.
first
}
}
...
@@ -205,8 +243,9 @@ open class TabBar: Bar {
...
@@ -205,8 +243,9 @@ open class TabBar: Bar {
*/
*/
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
isBounceEnabled
=
true
contentEdgeInsetsPreset
=
.
none
contentEdgeInsetsPreset
=
.
none
interimSpacePreset
=
.
none
interimSpacePreset
=
.
interimSpace5
prepareLine
()
prepareLine
()
prepareDivider
()
prepareDivider
()
}
}
...
...
Sources/iOS/TabMenuController.swift
deleted
100644 → 0
View file @
9b743d59
/*
* Copyright (C) 2015 - 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
/// A memory reference to the TabMenuBarItem instance for UIViewController extensions.
fileprivate
var
TabMenuBarItemKey
:
UInt8
=
0
open
class
TabMenuBarItem
:
FlatButton
{
open
override
func
prepare
()
{
super
.
prepare
()
pulseAnimation
=
.
none
}
}
@objc(TabMenuAlignment)
public
enum
TabMenuAlignment
:
Int
{
case
top
case
bottom
}
open
class
TabMenu
:
UIView
{
@IBInspectable
open
var
tabBar
=
TabBar
()
{
didSet
{
layoutSubviews
()
}
}
open
var
viewControllers
:
[
UIViewController
]
open
var
selectedIndex
:
Int
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
viewControllers
=
[]
selectedIndex
=
0
fatalError
(
"init(coder:) has not been implemented"
)
}
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
:
Int
=
0
)
{
self
.
viewControllers
=
viewControllers
self
.
selectedIndex
=
selectedIndex
super
.
init
(
frame
:
.
zero
)
}
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
}
/**
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
func
prepare
()
{
prepareTabBar
()
}
}
extension
TabMenu
{
fileprivate
func
prepareTabBar
()
{
tabBar
.
isLineAnimated
=
false
tabBar
.
lineAlignment
=
.
top
}
}
extension
UIViewController
{
/// tabMenuBarItem reference.
public
private(set)
var
tabMenuBarItem
:
TabMenuBarItem
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
TabMenuBarItemKey
)
{
return
TabMenuBarItem
()
}
}
set
(
value
)
{
AssociateObject
(
base
:
self
,
key
:
&
TabMenuBarItemKey
,
value
:
value
)
}
}
}
extension
UIViewController
{
/**
A convenience property that provides access to the TabMenuController.
This is the recommended method of accessing the TabMenuController
through child UIViewControllers.
*/
public
var
tabMenuBarController
:
TabMenuController
?
{
var
viewController
:
UIViewController
?
=
self
while
nil
!=
viewController
{
if
viewController
is
TabMenuController
{
return
viewController
as?
TabMenuController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
open
class
TabMenuController
:
UIViewController
{
/// A reference to the TabMenu instance.
@IBInspectable
open
let
tabMenu
:
TabMenu
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
tabMenu
=
TabMenu
(
viewControllers
:
[])
super
.
init
(
coder
:
aDecoder
)
}
/**
An initializer that accepts an Array of UIViewControllers.
- Parameter viewControllers: An Array of UIViewControllers.
*/
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
:
Int
=
0
)
{
tabMenu
=
TabMenu
(
viewControllers
:
viewControllers
,
selectedIndex
:
selectedIndex
)
super
.
init
(
nibName
:
nil
,
bundle
:
nil
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepare
()
}
/**
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
func
prepare
()
{
}
}
Sources/iOS/TextField.swift
View file @
58a5469c
...
@@ -389,12 +389,16 @@ open class TextField: UITextField {
...
@@ -389,12 +389,16 @@ open class TextField: UITextField {
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShape
()
layoutShape
()
reload
()
layoutPlaceholderLabel
()
layoutDetailLabel
()
layoutButton
(
button
:
clearIconButton
)
layoutButton
(
button
:
visibilityIconButton
)
layoutDivider
()
layoutLeftView
()
}
}
open
override
func
becomeFirstResponder
()
->
Bool
{
open
override
func
becomeFirstResponder
()
->
Bool
{
setNeedsLayout
()
layoutSubviews
()
layoutIfNeeded
()
return
super
.
becomeFirstResponder
()
return
super
.
becomeFirstResponder
()
}
}
...
@@ -402,7 +406,10 @@ open class TextField: UITextField {
...
@@ -402,7 +406,10 @@ open class TextField: UITextField {
open
var
textInset
:
CGFloat
=
0
open
var
textInset
:
CGFloat
=
0
open
override
func
textRect
(
forBounds
bounds
:
CGRect
)
->
CGRect
{
open
override
func
textRect
(
forBounds
bounds
:
CGRect
)
->
CGRect
{
return
bounds
.
insetBy
(
dx
:
textInset
,
dy
:
0
)
var
b
=
super
.
textRect
(
forBounds
:
bounds
)
b
.
origin
.
x
+=
textInset
b
.
size
.
width
-=
textInset
return
b
}
}
open
override
func
editingRect
(
forBounds
bounds
:
CGRect
)
->
CGRect
{
open
override
func
editingRect
(
forBounds
bounds
:
CGRect
)
->
CGRect
{
...
@@ -430,16 +437,6 @@ open class TextField: UITextField {
...
@@ -430,16 +437,6 @@ open class TextField: UITextField {
prepareTargetHandlers
()
prepareTargetHandlers
()
prepareTextAlignment
()
prepareTextAlignment
()
}
}
/// Ensures that the components are sized correctly.
open
func
reload
()
{
layoutPlaceholderLabel
()
layoutDetailLabel
()
layoutButton
(
button
:
clearIconButton
)
layoutButton
(
button
:
visibilityIconButton
)
layoutDivider
()
layoutLeftView
()
}
}
}
extension
TextField
{
extension
TextField
{
...
...
Sources/iOS/TextView.swift
View file @
58a5469c
...
@@ -87,7 +87,6 @@ public protocol TextViewDelegate : UITextViewDelegate {
...
@@ -87,7 +87,6 @@ public protocol TextViewDelegate : UITextViewDelegate {
optional
func
textView
(
textView
:
TextView
,
didProcessEditing
textStorage
:
TextStorage
,
text
:
String
,
range
:
NSRange
)
optional
func
textView
(
textView
:
TextView
,
didProcessEditing
textStorage
:
TextStorage
,
text
:
String
,
range
:
NSRange
)
}
}
@objc(TextView)
open
class
TextView
:
UITextView
{
open
class
TextView
:
UITextView
{
/// A boolean indicating whether the text is empty.
/// A boolean indicating whether the text is empty.
open
var
isEmpty
:
Bool
{
open
var
isEmpty
:
Bool
{
...
...
Sources/iOS/Toolbar.swift
View file @
58a5469c
...
@@ -95,9 +95,11 @@ open class Toolbar: Bar {
...
@@ -95,9 +95,11 @@ open class Toolbar: Bar {
contentViewAlignment
=
.
center
==
titleLabel
.
textAlignment
?
.
center
:
.
full
contentViewAlignment
=
.
center
==
titleLabel
.
textAlignment
?
.
center
:
.
full
}
}
/// Reloads the view.
open
override
func
layoutSubviews
()
{
open
override
func
reload
()
{
super
.
layoutSubviews
()
super
.
reload
()
guard
willLayout
else
{
return
}
if
nil
!=
title
&&
""
!=
title
{
if
nil
!=
title
&&
""
!=
title
{
if
nil
==
titleLabel
.
superview
{
if
nil
==
titleLabel
.
superview
{
...
...
Sources/iOS/ToolbarController.swift
View file @
58a5469c
...
@@ -69,17 +69,6 @@ public protocol ToolbarControllerDelegate {
...
@@ -69,17 +69,6 @@ public protocol ToolbarControllerDelegate {
@objc(ToolbarController)
@objc(ToolbarController)
open
class
ToolbarController
:
StatusBarController
{
open
class
ToolbarController
:
StatusBarController
{
/**
A Display value to indicate whether or not to
display the rootViewController to the full view
bounds, or up to the toolbar height.
*/
open
var
toolbarDisplay
=
Display
.
partial
{
didSet
{
layoutSubviews
()
}
}
/// Reference to the Toolbar.
/// Reference to the Toolbar.
@IBInspectable
@IBInspectable
open
let
toolbar
=
Toolbar
()
open
let
toolbar
=
Toolbar
()
...
@@ -186,7 +175,7 @@ open class ToolbarController: StatusBarController {
...
@@ -186,7 +175,7 @@ open class ToolbarController: StatusBarController {
toolbar
.
y
=
y
toolbar
.
y
=
y
toolbar
.
width
=
view
.
width
toolbar
.
width
=
view
.
width
switch
toolbarDisplay
{
switch
displayStyle
{
case
.
partial
:
case
.
partial
:
let
h
=
y
+
toolbar
.
height
let
h
=
y
+
toolbar
.
height
rootViewController
.
view
.
y
=
h
rootViewController
.
view
.
y
=
h
...
@@ -205,6 +194,7 @@ open class ToolbarController: StatusBarController {
...
@@ -205,6 +194,7 @@ open class ToolbarController: StatusBarController {
*/
*/
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
displayStyle
=
.
partial
prepareStatusBar
()
prepareStatusBar
()
prepareToolbar
()
prepareToolbar
()
}
}
...
...
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