Commit 3dd4d434 by Daniel Dahan

Update shadowPath animation to happen when laying out subviews, rather than when…

Update shadowPath animation to happen when laying out subviews, rather than when laying out sublayers.
parent b96584a0
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
967513CC1C136BB7009F455A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967513CB1C136BB7009F455A /* ViewController.swift */; }; 967513CC1C136BB7009F455A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967513CB1C136BB7009F455A /* ViewController.swift */; };
967513D11C136BB7009F455A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 967513D01C136BB7009F455A /* Assets.xcassets */; }; 967513D11C136BB7009F455A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 967513D01C136BB7009F455A /* Assets.xcassets */; };
967513D41C136BB7009F455A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 967513D21C136BB7009F455A /* LaunchScreen.storyboard */; }; 967513D41C136BB7009F455A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 967513D21C136BB7009F455A /* LaunchScreen.storyboard */; };
96B8C0AE1D04D0D90084F68A /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96B8C0AD1D04D0D90084F68A /* Material.framework */; };
96B8C0AF1D04D0D90084F68A /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96B8C0AD1D04D0D90084F68A /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96B8C0AF1D04D0D90084F68A /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -36,7 +33,6 @@ ...@@ -36,7 +33,6 @@
967513D01C136BB7009F455A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 967513D01C136BB7009F455A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
967513D31C136BB7009F455A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 967513D31C136BB7009F455A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
967513D51C136BB7009F455A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 967513D51C136BB7009F455A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96B8C0AD1D04D0D90084F68A /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-dciwtavdzrmtrifplxfnouazaqvx/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96B8C0AE1D04D0D90084F68A /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
967513BD1C136BB7009F455A = { 967513BD1C136BB7009F455A = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96B8C0AD1D04D0D90084F68A /* Material.framework */,
967513C81C136BB7009F455A /* CardView */, 967513C81C136BB7009F455A /* CardView */,
967513C71C136BB7009F455A /* Products */, 967513C71C136BB7009F455A /* Products */,
); );
......
...@@ -192,8 +192,6 @@ public class MaterialButton : UIButton { ...@@ -192,8 +192,6 @@ public class MaterialButton : UIButton {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
} else {
shadowPath = nil
} }
} }
} }
...@@ -345,10 +343,14 @@ public class MaterialButton : UIButton { ...@@ -345,10 +343,14 @@ public class MaterialButton : UIButton {
if self.layer == layer { if self.layer == layer {
layoutShape() layoutShape()
layoutVisualLayer() layoutVisualLayer()
layoutShadowPath()
} }
} }
public override func layoutSubviews() {
super.layoutSubviews()
layoutShadowPath()
}
public override func alignmentRectInsets() -> UIEdgeInsets { public override func alignmentRectInsets() -> UIEdgeInsets {
return UIEdgeInsetsZero return UIEdgeInsetsZero
} }
......
...@@ -299,8 +299,6 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -299,8 +299,6 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
} else {
shadowPath = nil
} }
} }
} }
...@@ -450,10 +448,14 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -450,10 +448,14 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
if self.layer == layer { if self.layer == layer {
layoutShape() layoutShape()
layoutVisualLayer() layoutVisualLayer()
layoutShadowPath()
} }
} }
public override func layoutSubviews() {
super.layoutSubviews()
layoutShadowPath()
}
/** /**
A method that accepts CAAnimation objects and executes them on the A method that accepts CAAnimation objects and executes them on the
view's backing layer. view's backing layer.
......
...@@ -299,8 +299,6 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -299,8 +299,6 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
} else {
shadowPath = nil
} }
} }
} }
...@@ -450,10 +448,14 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -450,10 +448,14 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
if self.layer == layer { if self.layer == layer {
layoutShape() layoutShape()
layoutVisualLayer() layoutVisualLayer()
layoutShadowPath()
} }
} }
public override func layoutSubviews() {
super.layoutSubviews()
layoutShadowPath()
}
/** /**
A method that accepts CAAnimation objects and executes them on the A method that accepts CAAnimation objects and executes them on the
view's backing layer. view's backing layer.
......
...@@ -165,8 +165,6 @@ public class MaterialLayer : CAShapeLayer { ...@@ -165,8 +165,6 @@ public class MaterialLayer : CAShapeLayer {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
} else {
shadowPath = nil
} }
} }
} }
...@@ -278,6 +276,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -278,6 +276,7 @@ public class MaterialLayer : CAShapeLayer {
super.layoutSublayers() super.layoutSublayers()
layoutShape() layoutShape()
layoutVisualLayer() layoutVisualLayer()
layoutShadowPath()
} }
/** /**
......
...@@ -185,8 +185,6 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -185,8 +185,6 @@ public class MaterialTableViewCell : UITableViewCell {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
} else {
shadowPath = nil
} }
} }
} }
...@@ -300,10 +298,14 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -300,10 +298,14 @@ public class MaterialTableViewCell : UITableViewCell {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
layoutVisualLayer() layoutVisualLayer()
layoutShadowPath()
} }
} }
public override func layoutSubviews() {
super.layoutSubviews()
layoutShadowPath()
}
/** /**
A method that accepts CAAnimation objects and executes them on the A method that accepts CAAnimation objects and executes them on the
view's backing layer. view's backing layer.
......
...@@ -246,8 +246,6 @@ public class MaterialView : UIView { ...@@ -246,8 +246,6 @@ public class MaterialView : UIView {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
} else {
shadowPath = nil
} }
} }
} }
...@@ -391,10 +389,14 @@ public class MaterialView : UIView { ...@@ -391,10 +389,14 @@ public class MaterialView : UIView {
if self.layer == layer { if self.layer == layer {
layoutShape() layoutShape()
layoutVisualLayer() layoutVisualLayer()
layoutShadowPath()
} }
} }
public override func layoutSubviews() {
super.layoutSubviews()
layoutShadowPath()
}
/** /**
A method that accepts CAAnimation objects and executes them on the A method that accepts CAAnimation objects and executes them on the
view's backing layer. view's backing layer.
......
...@@ -148,8 +148,6 @@ public class TextView: UITextView { ...@@ -148,8 +148,6 @@ public class TextView: UITextView {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
} else {
shadowPath = nil
} }
} }
} }
...@@ -340,17 +338,11 @@ public class TextView: UITextView { ...@@ -340,17 +338,11 @@ public class TextView: UITextView {
/// Overriding the layout callback for subviews. /// Overriding the layout callback for subviews.
public override func layoutSubviews() { public override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
layoutShadowPath()
placeholderLabel?.preferredMaxLayoutWidth = textContainer.size.width - textContainer.lineFragmentPadding * 2 placeholderLabel?.preferredMaxLayoutWidth = textContainer.size.width - textContainer.lineFragmentPadding * 2
titleLabel?.frame.size.width = bounds.width titleLabel?.frame.size.width = bounds.width
} }
public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer)
if self.layer == layer {
layoutShadowPath()
}
}
/** /**
A method that accepts CAAnimation objects and executes them on the A method that accepts CAAnimation objects and executes them on the
view's backing layer. view's backing layer.
......
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