Commit aaab03b5 by Daniel Dahan

updated Divider access

parent 3898ce7f
...@@ -55,6 +55,6 @@ class AppBottomNavigationController: BottomNavigationController { ...@@ -55,6 +55,6 @@ class AppBottomNavigationController: BottomNavigationController {
/// Prepares the tabBar. /// Prepares the tabBar.
private func prepareTabBar() { private func prepareTabBar() {
tabBar.depthPreset = .none tabBar.depthPreset = .none
tabBar.divider.color = Color.grey.lighten3 tabBar.dividerColor = Color.grey.lighten3
} }
} }
...@@ -124,8 +124,8 @@ class ViewController: UIViewController { ...@@ -124,8 +124,8 @@ class ViewController: UIViewController {
bottomBar.contentEdgeInsetsPreset = .square1 bottomBar.contentEdgeInsetsPreset = .square1
bottomBar.cornerRadiusPreset = .cornerRadius1 bottomBar.cornerRadiusPreset = .cornerRadius1
bottomBar.divider.color = Color.grey.lighten3 bottomBar.dividerColor = Color.grey.lighten3
bottomBar.divider.alignment = .top bottomBar.dividerAlignment = .top
bottomBar.contentView.grid.views = [favoriteButton, shareButton, starButton] bottomBar.contentView.grid.views = [favoriteButton, shareButton, starButton]
} }
......
...@@ -119,8 +119,8 @@ class ViewController: UIViewController { ...@@ -119,8 +119,8 @@ class ViewController: UIViewController {
bottomBar.contentEdgeInsetsPreset = .square1 bottomBar.contentEdgeInsetsPreset = .square1
bottomBar.cornerRadiusPreset = .cornerRadius1 bottomBar.cornerRadiusPreset = .cornerRadius1
bottomBar.divider.color = Color.grey.lighten3 bottomBar.dividerColor = Color.grey.lighten3
bottomBar.divider.alignment = .top bottomBar.dividerAlignment = .top
bottomBar.contentView.grid.views = [favoriteButton, shareButton, starButton] bottomBar.contentView.grid.views = [favoriteButton, shareButton, starButton]
} }
......
...@@ -42,6 +42,6 @@ class AppToolbarController: ToolbarController { ...@@ -42,6 +42,6 @@ class AppToolbarController: ToolbarController {
private func prepareToolbar() { private func prepareToolbar() {
toolbar.title = "Photo Library" toolbar.title = "Photo Library"
toolbar.depthPreset = .none toolbar.depthPreset = .none
toolbar.divider.color = Color.grey.lighten3 toolbar.dividerColor = Color.grey.lighten3
} }
} }
...@@ -50,7 +50,7 @@ class PhotoLibraryCollectionReusableView: CollectionReusableView { ...@@ -50,7 +50,7 @@ class PhotoLibraryCollectionReusableView: CollectionReusableView {
toolbar.contentEdgeInsets.left = 16 toolbar.contentEdgeInsets.left = 16
toolbar.contentEdgeInsets.right = 16 toolbar.contentEdgeInsets.right = 16
toolbar.depthPreset = .none toolbar.depthPreset = .none
toolbar.divider.color = Color.grey.lighten3 toolbar.dividerColor = Color.grey.lighten3
layout(toolbar).edges() layout(toolbar).edges()
} }
} }
...@@ -127,8 +127,8 @@ class ViewController: UIViewController { ...@@ -127,8 +127,8 @@ class ViewController: UIViewController {
bottomBar.contentEdgeInsetsPreset = .square1 bottomBar.contentEdgeInsetsPreset = .square1
bottomBar.cornerRadiusPreset = .cornerRadius1 bottomBar.cornerRadiusPreset = .cornerRadius1
bottomBar.divider.color = Color.grey.lighten3 bottomBar.dividerColor = Color.grey.lighten3
bottomBar.divider.alignment = .top bottomBar.dividerAlignment = .top
bottomBar.contentView.grid.views = [favoriteButton, shareButton, starButton] bottomBar.contentView.grid.views = [favoriteButton, shareButton, starButton]
} }
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
96784FD81D906DCB0061C06C /* RemindersItemsCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96784FD71D906DCB0061C06C /* RemindersItemsCollectionView.swift */; }; 96784FD81D906DCB0061C06C /* RemindersItemsCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96784FD71D906DCB0061C06C /* RemindersItemsCollectionView.swift */; };
96784FDA1D906DF60061C06C /* RemindersItemsCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96784FD91D906DF60061C06C /* RemindersItemsCollectionViewCell.swift */; }; 96784FDA1D906DF60061C06C /* RemindersItemsCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96784FD91D906DF60061C06C /* RemindersItemsCollectionViewCell.swift */; };
96784FDC1D906E190061C06C /* AppNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96784FDB1D906E190061C06C /* AppNavigationController.swift */; }; 96784FDC1D906E190061C06C /* AppNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96784FDB1D906E190061C06C /* AppNavigationController.swift */; };
9690B3F81D99DFA000E7F42A /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9690B3F71D99DFA000E7F42A /* Material.framework */; };
9690B3F91D99DFA000E7F42A /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9690B3F71D99DFA000E7F42A /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -28,7 +26,6 @@ ...@@ -28,7 +26,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9690B3F91D99DFA000E7F42A /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -48,7 +45,6 @@ ...@@ -48,7 +45,6 @@
96784FD71D906DCB0061C06C /* RemindersItemsCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersItemsCollectionView.swift; sourceTree = "<group>"; }; 96784FD71D906DCB0061C06C /* RemindersItemsCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersItemsCollectionView.swift; sourceTree = "<group>"; };
96784FD91D906DF60061C06C /* RemindersItemsCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersItemsCollectionViewCell.swift; sourceTree = "<group>"; }; 96784FD91D906DF60061C06C /* RemindersItemsCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersItemsCollectionViewCell.swift; sourceTree = "<group>"; };
96784FDB1D906E190061C06C /* AppNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppNavigationController.swift; sourceTree = "<group>"; }; 96784FDB1D906E190061C06C /* AppNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppNavigationController.swift; sourceTree = "<group>"; };
9690B3F71D99DFA000E7F42A /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Material.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -56,7 +52,6 @@ ...@@ -56,7 +52,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9690B3F81D99DFA000E7F42A /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -66,7 +61,6 @@ ...@@ -66,7 +61,6 @@
96784F2B1D901F610061C06C = { 96784F2B1D901F610061C06C = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9690B3F71D99DFA000E7F42A /* Material.framework */,
96784F361D901F610061C06C /* RemindersController */, 96784F361D901F610061C06C /* RemindersController */,
96784F351D901F610061C06C /* Products */, 96784F351D901F610061C06C /* Products */,
); );
...@@ -131,7 +125,6 @@ ...@@ -131,7 +125,6 @@
TargetAttributes = { TargetAttributes = {
96784F331D901F610061C06C = { 96784F331D901F610061C06C = {
CreatedOnToolsVersion = 8.0; CreatedOnToolsVersion = 8.0;
DevelopmentTeam = 9Z76XCNLGL;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
}; };
...@@ -293,7 +286,7 @@ ...@@ -293,7 +286,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9Z76XCNLGL; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = RemindersController/Info.plist; INFOPLIST_FILE = RemindersController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.RemindersController; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.RemindersController;
...@@ -306,7 +299,7 @@ ...@@ -306,7 +299,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9Z76XCNLGL; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = RemindersController/Info.plist; INFOPLIST_FILE = RemindersController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.RemindersController; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.RemindersController;
......
...@@ -46,7 +46,7 @@ class AppNavigationController: NavigationController { ...@@ -46,7 +46,7 @@ class AppNavigationController: NavigationController {
} }
v.depthPreset = .none v.depthPreset = .none
v.divider.color = Color.grey.lighten3 v.dividerColor = Color.grey.lighten3
} }
} }
...@@ -63,8 +63,8 @@ class ViewController: UIViewController { ...@@ -63,8 +63,8 @@ class ViewController: UIViewController {
private func prepareTabBar() { private func prepareTabBar() {
tabBar = TabBar() tabBar = TabBar()
tabBar.divider.color = Color.grey.lighten3 tabBar.dividerColor = Color.grey.lighten3
tabBar.divider.alignment = .top tabBar.dividerAlignment = .top
tabBar.lineColor = Color.blue.base tabBar.lineColor = Color.blue.base
tabBar.lineAlignment = .top tabBar.lineAlignment = .top
......
...@@ -37,6 +37,41 @@ public enum ContentViewAlignment: Int { ...@@ -37,6 +37,41 @@ public enum ContentViewAlignment: Int {
} }
open class Bar: View { open class Bar: View {
/// Divider layer.
internal private(set) var divider: Divider!
/// Divider color.
@IBInspectable
open var dividerColor: UIColor? {
get {
return divider.color
}
set(value) {
divider.color = value
}
}
/// Divider animation.
open var dividerAlignment: DividerAlignment {
get {
return divider.alignment
}
set(value) {
divider.alignment = value
}
}
/// Divider height.
@IBInspectable
open var dividerHeight: CGFloat {
get {
return divider.height
}
set(value) {
divider.height = value
}
}
/// Should center the contentView. /// Should center the contentView.
open var contentViewAlignment = ContentViewAlignment.any { open var contentViewAlignment = ContentViewAlignment.any {
didSet { didSet {
...@@ -101,41 +136,6 @@ open class Bar: View { ...@@ -101,41 +136,6 @@ open class Bar: View {
} }
} }
/// Divider layer.
internal lazy var divider: Divider = Divider(view: self)
/// Divider color.
@IBInspectable
open var dividerColor: UIColor? {
get {
return divider.color
}
set(value) {
divider.color = value
}
}
/// Divider animation.
open var dividerAlignment: DividerAlignment {
get {
return divider.alignment
}
set(value) {
divider.alignment = value
}
}
/// Divider height.
@IBInspectable
open var dividerHeight: CGFloat {
get {
return divider.height
}
set(value) {
divider.height = value
}
}
/// ContentView that holds the any desired subviews. /// ContentView that holds the any desired subviews.
open private(set) lazy var contentView = View() open private(set) lazy var contentView = View()
...@@ -265,10 +265,16 @@ open class Bar: View { ...@@ -265,10 +265,16 @@ open class Bar: View {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
prepareContentView() prepareContentView()
prepareDivider()
} }
/// Prepares the contentView. /// Prepares the contentView.
private func prepareContentView() { private func prepareContentView() {
contentView.backgroundColor = nil contentView.backgroundColor = nil
} }
/// Prepares the divider.
private func prepareDivider() {
divider = Divider(view: self)
}
} }
...@@ -159,7 +159,7 @@ open class BottomNavigationController: UITabBarController, UITabBarControllerDel ...@@ -159,7 +159,7 @@ open class BottomNavigationController: UITabBarController, UITabBarControllerDel
/// Prepares the tabBar. /// Prepares the tabBar.
private func prepareTabBar() { private func prepareTabBar() {
tabBar.depthPreset = .depth1 tabBar.depthPreset = .depth1
tabBar.divider.alignment = .top tabBar.dividerAlignment = .top
let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1)) let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1))
tabBar.shadowImage = image tabBar.shadowImage = image
tabBar.backgroundImage = image tabBar.backgroundImage = image
......
...@@ -137,7 +137,7 @@ private var TabBarKey: UInt8 = 0 ...@@ -137,7 +137,7 @@ private var TabBarKey: UInt8 = 0
extension UITabBar { extension UITabBar {
/// TabBarItem reference. /// TabBarItem reference.
internal private(set) var divider: Divider! { internal private(set) var divider: Divider {
get { get {
return AssociatedObject(base: self, key: &TabBarKey) { return AssociatedObject(base: self, key: &TabBarKey) {
return Divider(view: self) return Divider(view: self)
......
...@@ -33,7 +33,7 @@ import UIKit ...@@ -33,7 +33,7 @@ import UIKit
@objc(CollectionViewCell) @objc(CollectionViewCell)
open class CollectionViewCell: UICollectionViewCell { open class CollectionViewCell: UICollectionViewCell {
/// Divider layer. /// Divider layer.
internal private(set) lazy var divider: Divider = Divider(view: self) internal private(set) var divider: Divider!
/// Divider color. /// Divider color.
@IBInspectable @IBInspectable
...@@ -331,6 +331,7 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -331,6 +331,7 @@ open class CollectionViewCell: UICollectionViewCell {
open func prepare() { open func prepare() {
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
prepareVisualLayer() prepareVisualLayer()
prepareDivider()
} }
/// Prepares the visualLayer property. /// Prepares the visualLayer property.
...@@ -345,4 +346,9 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -345,4 +346,9 @@ open class CollectionViewCell: UICollectionViewCell {
visualLayer.frame = bounds visualLayer.frame = bounds
visualLayer.cornerRadius = cornerRadius visualLayer.cornerRadius = cornerRadius
} }
/// Prepares the divider.
private func prepareDivider() {
divider = Divider(view: self)
}
} }
...@@ -40,7 +40,7 @@ public enum NavigationBarStyle: Int { ...@@ -40,7 +40,7 @@ public enum NavigationBarStyle: Int {
open class NavigationBar: UINavigationBar { open class NavigationBar: UINavigationBar {
/// Divider layer. /// Divider layer.
internal private(set) lazy var divider: Divider = Divider(view: self) internal private(set) var divider: Divider!
/// Divider color. /// Divider color.
@IBInspectable @IBInspectable
...@@ -335,6 +335,7 @@ open class NavigationBar: UINavigationBar { ...@@ -335,6 +335,7 @@ open class NavigationBar: UINavigationBar {
shadowImage = image shadowImage = image
setBackgroundImage(image, for: .default) setBackgroundImage(image, for: .default)
backgroundColor = Color.white backgroundColor = Color.white
prepareDivider()
} }
/** /**
...@@ -356,4 +357,9 @@ open class NavigationBar: UINavigationBar { ...@@ -356,4 +357,9 @@ open class NavigationBar: UINavigationBar {
} }
item.titleView = UIView(frame: .zero) item.titleView = UIView(frame: .zero)
} }
/// Prepares the divider.
private func prepareDivider() {
divider = Divider(view: self)
}
} }
...@@ -258,7 +258,7 @@ open class PageTabBarController: RootController { ...@@ -258,7 +258,7 @@ open class PageTabBarController: RootController {
/// Prepares the pageTabBar. /// Prepares the pageTabBar.
private func preparePageTabBar() { private func preparePageTabBar() {
pageTabBar.zPosition = 1000 pageTabBar.zPosition = 1000
pageTabBar.divider.color = Color.grey.lighten3 pageTabBar.dividerColor = Color.grey.lighten3
view.addSubview(pageTabBar) view.addSubview(pageTabBar)
pageTabBar.select(at: selectedIndex) pageTabBar.select(at: selectedIndex)
} }
......
...@@ -225,7 +225,7 @@ open class TabBar: Bar { ...@@ -225,7 +225,7 @@ open class TabBar: Bar {
/// Prepares the divider. /// Prepares the divider.
private func prepareDivider() { private func prepareDivider() {
divider.alignment = .top dividerAlignment = .top
} }
/** /**
......
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