Commit 58a5469c by Daniel Dahan Committed by GitHub

Merge branch 'development' into development

parents 9b743d59 98166c9a
...@@ -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 /* TabMenuController.swift */; }; 9606CFAC1E957AC3006B4E74 /* PageMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9606CFAB1E957AC3006B4E74 /* PageMenuController.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 /* DisplayStyle.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 /* DisplayStyle.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 = TabMenuController.swift; sourceTree = "<group>"; }; 9606CFAB1E957AC3006B4E74 /* PageMenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageMenuController.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 /* DisplayStyle.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 /* DisplayStyle.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 /* PageTabMenu */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
963FBF071D669D14008F8512 /* PageTabBarController.swift */, 963FBF071D669D14008F8512 /* PageTabBarController.swift */,
9606CFAB1E957AC3006B4E74 /* TabMenuController.swift */, 9606CFAB1E957AC3006B4E74 /* PageMenuController.swift */,
); );
name = TabMenu; name = PageTabMenu;
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 /* PageTabMenu */,
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 /* DisplayStyle.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 /* DisplayStyle.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 /* TabMenuController.swift in Sources */, 9606CFAC1E957AC3006B4E74 /* PageMenuController.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 */,
......
...@@ -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 = UIScrollView()
/// 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
} }
} }
...@@ -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 {
......
...@@ -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()
......
...@@ -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()
} }
} }
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
import UIKit import UIKit
@objc(Display) @objc(DisplayStyle)
public enum Display: Int { public enum DisplayStyle: Int {
case partial case partial
case full case full
} }
...@@ -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
......
...@@ -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
......
...@@ -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()
} }
......
...@@ -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]
} }
......
...@@ -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
......
...@@ -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()
} }
......
/*
* 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() {
}
}
...@@ -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 {
......
...@@ -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 {
......
...@@ -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 {
......
...@@ -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()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment