Commit 7560013c by Daniel Dahan

development: updated Motion Framework and added back button management for…

development: updated Motion Framework and added back button management for NavigationBar and NavigationItem
parent d3247fbd
Subproject commit e275fffc6eede491be187a7c11787367c3ac906f Subproject commit 8fb973a5737a3514ff5a0ec973abfb84ad88013e
...@@ -103,6 +103,10 @@ ...@@ -103,6 +103,10 @@
965E81231DD4D7C800D61E4B /* BottomTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7591CB40DC500C806FE /* BottomTabBar.swift */; }; 965E81231DD4D7C800D61E4B /* BottomTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7591CB40DC500C806FE /* BottomTabBar.swift */; };
965E81261DD4D7C800D61E4B /* CharacterAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961276621DCD8B1800A7D920 /* CharacterAttribute.swift */; }; 965E81261DD4D7C800D61E4B /* CharacterAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961276621DCD8B1800A7D920 /* CharacterAttribute.swift */; };
966C17731F0439F600D3E83C /* Material+MotionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966C17721F0439F600D3E83C /* Material+MotionAnimation.swift */; }; 966C17731F0439F600D3E83C /* Material+MotionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966C17721F0439F600D3E83C /* Material+MotionAnimation.swift */; };
9685D5AF1F0F04CB00AFEB79 /* CardCollectionViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9656895E1F002F16001C656D /* CardCollectionViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9685D5B01F0F04CB00AFEB79 /* CardCollectionViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965689601F002F4C001C656D /* CardCollectionViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9685D5B11F0F04CB00AFEB79 /* Material+MotionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 966C17721F0439F600D3E83C /* Material+MotionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9685D5B21F0F04CB00AFEB79 /* PanController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96DE566B1EF1B63B006DA70E /* PanController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7BF1D8F2572004741EC /* Divider.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96230AB71D6A520C00AF47DC /* Divider.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7BF1D8F2572004741EC /* Divider.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96230AB71D6A520C00AF47DC /* Divider.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7C01D8F2572004741EC /* Material+CALayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96F1DC871D654FDF0025F925 /* Material+CALayer.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7C01D8F2572004741EC /* Material+CALayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96F1DC871D654FDF0025F925 /* Material+CALayer.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7C11D8F2572004741EC /* Material+Array.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96C1C8801D42C62800E6608F /* Material+Array.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7C11D8F2572004741EC /* Material+Array.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96C1C8801D42C62800E6608F /* Material+Array.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -180,7 +184,7 @@ ...@@ -180,7 +184,7 @@
remoteGlobalIDString = 96C98DD11E424AB000B22906; remoteGlobalIDString = 96C98DD11E424AB000B22906;
remoteInfo = "Motion iOS"; remoteInfo = "Motion iOS";
}; };
966A7F1F1EEC5D5900A2DAAC /* PBXContainerItemProxy */ = { 9685D5BC1F0F078B00AFEB79 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 966A7F191EEC5D5000A2DAAC /* Motion.xcodeproj */; containerPortal = 966A7F191EEC5D5000A2DAAC /* Motion.xcodeproj */;
proxyType = 1; proxyType = 1;
...@@ -817,15 +821,19 @@ ...@@ -817,15 +821,19 @@
961409B21E43D15C00E7BA99 /* FABMenuController.swift in Headers */, 961409B21E43D15C00E7BA99 /* FABMenuController.swift in Headers */,
96BFC16F1E63C10A0075DE1F /* SpringAnimation.swift in Headers */, 96BFC16F1E63C10A0075DE1F /* SpringAnimation.swift in Headers */,
964335BA1EC9432400FA9954 /* TabsController.swift in Headers */, 964335BA1EC9432400FA9954 /* TabsController.swift in Headers */,
9685D5AF1F0F04CB00AFEB79 /* CardCollectionViewCell.swift in Headers */,
9685D5B01F0F04CB00AFEB79 /* CardCollectionViewController.swift in Headers */,
9685D5B11F0F04CB00AFEB79 /* Material+MotionAnimation.swift in Headers */,
9685D5B21F0F04CB00AFEB79 /* PanController.swift in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXHeadersBuildPhase section */ /* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
963832351B88DFD80015F710 /* Material iOS */ = { 963832351B88DFD80015F710 /* Material */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material iOS" */; buildConfigurationList = 9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material" */;
buildPhases = ( buildPhases = (
963832311B88DFD80015F710 /* Sources */, 963832311B88DFD80015F710 /* Sources */,
963832331B88DFD80015F710 /* Headers */, 963832331B88DFD80015F710 /* Headers */,
...@@ -834,9 +842,9 @@ ...@@ -834,9 +842,9 @@
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
966A7F201EEC5D5900A2DAAC /* PBXTargetDependency */, 9685D5BD1F0F078B00AFEB79 /* PBXTargetDependency */,
); );
name = "Material iOS"; name = Material;
productName = FocusKit; productName = FocusKit;
productReference = 963832361B88DFD80015F710 /* Material.framework */; productReference = 963832361B88DFD80015F710 /* Material.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
...@@ -879,7 +887,7 @@ ...@@ -879,7 +887,7 @@
); );
projectRoot = ""; projectRoot = "";
targets = ( targets = (
963832351B88DFD80015F710 /* Material iOS */, 963832351B88DFD80015F710 /* Material */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
...@@ -1001,10 +1009,10 @@ ...@@ -1001,10 +1009,10 @@
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */ /* Begin PBXTargetDependency section */
966A7F201EEC5D5900A2DAAC /* PBXTargetDependency */ = { 9685D5BD1F0F078B00AFEB79 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
name = "Motion iOS"; name = "Motion iOS";
targetProxy = 966A7F1F1EEC5D5900A2DAAC /* PBXContainerItemProxy */; targetProxy = 9685D5BC1F0F078B00AFEB79 /* PBXContainerItemProxy */;
}; };
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
...@@ -1172,7 +1180,7 @@ ...@@ -1172,7 +1180,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material iOS" */ = { 9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
9638324D1B88DFD80015F710 /* Debug */, 9638324D1B88DFD80015F710 /* Debug */,
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710" BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework" BuildableName = "Material.framework"
BlueprintName = "Material iOS" BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj"> ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710" BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework" BuildableName = "Material.framework"
BlueprintName = "Material iOS" BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj"> ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710" BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework" BuildableName = "Material.framework"
BlueprintName = "Material iOS" BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj"> ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710" BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework" BuildableName = "Material.framework"
BlueprintName = "Material iOS" BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj"> ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
......
...@@ -42,30 +42,30 @@ public enum BorderWidthPreset: Int { ...@@ -42,30 +42,30 @@ public enum BorderWidthPreset: Int {
case border7 case border7
case border8 case border8
case border9 case border9
}
/// A CGFloat representation of the border width preset.
/// Converts the BorderWidthPreset enum to a CGFloat value. public var cgFloatValue: CGFloat {
public func BorderWidthPresetToValue(preset: BorderWidthPreset) -> CGFloat { switch self {
switch preset { case .none:
case .none: return 0
return 0 case .border1:
case .border1: return 0.5
return 0.5 case .border2:
case .border2: return 1
return 1 case .border3:
case .border3: return 2
return 2 case .border4:
case .border4: return 3
return 3 case .border5:
case .border5: return 4
return 4 case .border6:
case .border6: return 5
return 5 case .border7:
case .border7: return 6
return 6 case .border8:
case .border8: return 7
return 7 case .border9:
case .border9: return 8
return 8 }
} }
} }
...@@ -51,7 +51,7 @@ fileprivate class MaterialLayer { ...@@ -51,7 +51,7 @@ fileprivate class MaterialLayer {
/// A preset property to set the borderWidth. /// A preset property to set the borderWidth.
fileprivate var borderWidthPreset = BorderWidthPreset.none { fileprivate var borderWidthPreset = BorderWidthPreset.none {
didSet { didSet {
layer?.borderWidth = BorderWidthPresetToValue(preset: borderWidthPreset) layer?.borderWidth = borderWidthPreset.cgFloatValue
} }
} }
......
...@@ -152,9 +152,16 @@ extension NavigationController: UINavigationBarDelegate { ...@@ -152,9 +152,16 @@ extension NavigationController: UINavigationBarDelegate {
*/ */
public func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool { public func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool {
if let v = navigationBar as? NavigationBar { if let v = navigationBar as? NavigationBar {
if nil == item.backButton.image && nil == item.backButton.title {
item.backButton.image = v.backButtonImage
}
item.backButton.addTarget(self, action: #selector(handleBackButton), for: .touchUpInside) item.backButton.addTarget(self, action: #selector(handleBackButton), for: .touchUpInside)
item.backButton.image = v.backButtonImage
item.leftViews.insert(item.backButton, at: 0) if !item.backButton.isHidden {
item.leftViews.insert(item.backButton, at: 0)
}
v.layoutNavigationItem(item: item) v.layoutNavigationItem(item: item)
} }
return true return true
......
...@@ -43,16 +43,16 @@ public class NavigationItem: NSObject { ...@@ -43,16 +43,16 @@ public class NavigationItem: NSObject {
} }
/// Back Button. /// Back Button.
public private(set) lazy var backButton: IconButton = IconButton() public fileprivate(set) lazy var backButton: IconButton = IconButton()
/// Content View. /// Content View.
public private(set) lazy var contentView = UIView() public fileprivate(set) var contentView = UIView()
/// Title label. /// Title label.
public private(set) lazy var titleLabel = UILabel() public fileprivate(set) var titleLabel = UILabel()
/// Detail label. /// Detail label.
public private(set) lazy var detailLabel = UILabel() public fileprivate(set) var detailLabel = UILabel()
/// Left items. /// Left items.
public var leftViews = [UIView]() { public var leftViews = [UIView]() {
...@@ -108,12 +108,12 @@ public class NavigationItem: NSObject { ...@@ -108,12 +108,12 @@ public class NavigationItem: NSObject {
} }
/// Reloads the subviews for the NavigationBar. /// Reloads the subviews for the NavigationBar.
internal func reload() { fileprivate func reload() {
navigationBar?.layoutSubviews() navigationBar?.layoutSubviews()
} }
/// Prepares the titleLabel. /// Prepares the titleLabel.
private func prepareTitleLabel() { fileprivate func prepareTitleLabel() {
titleLabel.textAlignment = .center titleLabel.textAlignment = .center
titleLabel.contentScaleFactor = Screen.scale titleLabel.contentScaleFactor = Screen.scale
titleLabel.font = RobotoFont.medium(with: 17) titleLabel.font = RobotoFont.medium(with: 17)
...@@ -122,7 +122,7 @@ public class NavigationItem: NSObject { ...@@ -122,7 +122,7 @@ public class NavigationItem: NSObject {
} }
/// Prepares the detailLabel. /// Prepares the detailLabel.
private func prepareDetailLabel() { fileprivate func prepareDetailLabel() {
detailLabel.textAlignment = .center detailLabel.textAlignment = .center
titleLabel.contentScaleFactor = Screen.scale titleLabel.contentScaleFactor = Screen.scale
detailLabel.font = RobotoFont.regular(with: 12) detailLabel.font = RobotoFont.regular(with: 12)
......
...@@ -147,15 +147,15 @@ public struct Pulse { ...@@ -147,15 +147,15 @@ public struct Pulse {
let t: TimeInterval = .center == animation ? 0.16125 : 0.325 let t: TimeInterval = .center == animation ? 0.16125 : 0.325
switch animation { // switch animation {
case .centerWithBacking, .backing, .pointWithBacking: // case .centerWithBacking, .backing, .pointWithBacking:
bLayer.animate(.background(color: color.withAlphaComponent(opacity / 2)), .duration(t)) // bLayer.animate(.duration(t))
default:break // default:break
} // }
switch animation { switch animation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking: case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking:
pLayer.animate(.scale(), .duration(t)) pLayer.animate(.scale(), .background(color: color.withAlphaComponent(opacity / 2)), .duration(t))
default:break default:break
} }
...@@ -181,11 +181,11 @@ public struct Pulse { ...@@ -181,11 +181,11 @@ public struct Pulse {
let t: TimeInterval = 0.325 let t: TimeInterval = 0.325
switch animation { // switch animation {
case .centerWithBacking, .backing, .pointWithBacking: // case .centerWithBacking, .backing, .pointWithBacking:
bLayer.animate(.background(color: color.withAlphaComponent(0)), .duration(t)) // bLayer.animate(.background(color: color.withAlphaComponent(0)), .duration(t))
default:break // default:break
} // }
switch animation { switch animation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking: case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking:
......
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