Commit e2ec3173 by Daniel Dahan

updated Layout class and documentation

parent 97b9e45b
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
96B8C0911D04BB430084F68A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96B8C0901D04BB430084F68A /* ViewController.swift */; }; 96B8C0911D04BB430084F68A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96B8C0901D04BB430084F68A /* ViewController.swift */; };
96B8C0961D04BB430084F68A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96B8C0951D04BB430084F68A /* Assets.xcassets */; }; 96B8C0961D04BB430084F68A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96B8C0951D04BB430084F68A /* Assets.xcassets */; };
96B8C0991D04BB430084F68A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96B8C0971D04BB430084F68A /* LaunchScreen.storyboard */; }; 96B8C0991D04BB430084F68A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96B8C0971D04BB430084F68A /* LaunchScreen.storyboard */; };
96CB74EF1D0CAE440012D9F2 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96CB74EE1D0CAE440012D9F2 /* Material.framework */; };
96CB74F01D0CAE440012D9F2 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96CB74EE1D0CAE440012D9F2 /* 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 = (
96CB74F01D0CAE440012D9F2 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -36,7 +33,6 @@ ...@@ -36,7 +33,6 @@
96B8C0951D04BB430084F68A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 96B8C0951D04BB430084F68A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96B8C0981D04BB430084F68A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 96B8C0981D04BB430084F68A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
96B8C09A1D04BB430084F68A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 96B8C09A1D04BB430084F68A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96CB74EE1D0CAE440012D9F2 /* 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 = (
96CB74EF1D0CAE440012D9F2 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
96B8C0821D04BB430084F68A = { 96B8C0821D04BB430084F68A = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96CB74EE1D0CAE440012D9F2 /* Material.framework */,
96B8C08D1D04BB430084F68A /* Layout */, 96B8C08D1D04BB430084F68A /* Layout */,
96B8C08C1D04BB430084F68A /* Products */, 96B8C08C1D04BB430084F68A /* Products */,
); );
......
...@@ -57,19 +57,23 @@ public class Layout { ...@@ -57,19 +57,23 @@ public class Layout {
/** /**
Prints a debug message when the parent context is not available. Prints a debug message when the parent context is not available.
- Parameter function: A String representation of the function that
caused the issue.
- Returns: The current Layout instance. - Returns: The current Layout instance.
*/ */
public func debugParentNotAvailableMessage() -> Layout { public func debugParentNotAvailableMessage(function: String = #function) -> Layout {
debugPrint("[Material Layout Error: Parent view context is not available.") debugPrint("[Material Layout Error: Parent view context is not available for \(function).")
return self return self
} }
/** /**
Prints a debug message when the child context is not available. Prints a debug message when the child context is not available.
- Parameter function: A String representation of the function that
caused the issue.
- Returns: The current Layout instance. - Returns: The current Layout instance.
*/ */
public func debugChildNotAvailableMessage() -> Layout { public func debugChildNotAvailableMessage(function: String = #function) -> Layout {
debugPrint("[Material Layout Error: Chld view context is not available.") debugPrint("[Material Layout Error: Chld view context is not available for \(function).")
return self return self
} }
...@@ -83,6 +87,7 @@ public class Layout { ...@@ -83,6 +87,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.width(v, child: child, width: width) Layout.width(v, child: child, width: width)
return self return self
} }
...@@ -109,6 +114,7 @@ public class Layout { ...@@ -109,6 +114,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.height(v, child: child, height: height) Layout.height(v, child: child, height: height)
return self return self
} }
...@@ -136,6 +142,7 @@ public class Layout { ...@@ -136,6 +142,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.size(v, child: child, width: width, height: height) Layout.size(v, child: child, width: width, height: height)
return self return self
} }
...@@ -198,6 +205,7 @@ public class Layout { ...@@ -198,6 +205,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.horizontally(v, child: child, left: left, right: right) Layout.horizontally(v, child: child, left: left, right: right)
return self return self
} }
...@@ -226,6 +234,7 @@ public class Layout { ...@@ -226,6 +234,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.vertically(v, child: child, top: top, bottom: bottom) Layout.vertically(v, child: child, top: top, bottom: bottom)
return self return self
} }
...@@ -256,6 +265,7 @@ public class Layout { ...@@ -256,6 +265,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.edges(v, child: child, top: top, left: left, bottom: bottom, right: right) Layout.edges(v, child: child, top: top, left: left, bottom: bottom, right: right)
return self return self
} }
...@@ -286,6 +296,7 @@ public class Layout { ...@@ -286,6 +296,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.top(v, child: child, top: top) Layout.top(v, child: child, top: top)
return self return self
} }
...@@ -312,6 +323,7 @@ public class Layout { ...@@ -312,6 +323,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.left(v, child: child, left: left) Layout.left(v, child: child, left: left)
return self return self
} }
...@@ -338,6 +350,7 @@ public class Layout { ...@@ -338,6 +350,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.bottom(v, child: child, bottom: bottom) Layout.bottom(v, child: child, bottom: bottom)
return self return self
} }
...@@ -365,6 +378,7 @@ public class Layout { ...@@ -365,6 +378,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.right(v, child: child, right: right) Layout.right(v, child: child, right: right)
return self return self
} }
...@@ -392,6 +406,7 @@ public class Layout { ...@@ -392,6 +406,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.topLeft(v, child: child, top: top, left: left) Layout.topLeft(v, child: child, top: top, left: left)
return self return self
} }
...@@ -420,6 +435,7 @@ public class Layout { ...@@ -420,6 +435,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.topRight(v, child: child, top: top, right: right) Layout.topRight(v, child: child, top: top, right: right)
return self return self
} }
...@@ -448,6 +464,7 @@ public class Layout { ...@@ -448,6 +464,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.bottomLeft(v, child: child, bottom: bottom, left: left) Layout.bottomLeft(v, child: child, bottom: bottom, left: left)
return self return self
} }
...@@ -476,6 +493,7 @@ public class Layout { ...@@ -476,6 +493,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.bottomRight(v, child: child, bottom: bottom, right: right) Layout.bottomRight(v, child: child, bottom: bottom, right: right)
return self return self
} }
...@@ -504,6 +522,7 @@ public class Layout { ...@@ -504,6 +522,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.center(v, child: child, offsetX: offsetX, offsetY: offsetY) Layout.center(v, child: child, offsetX: offsetX, offsetY: offsetY)
return self return self
} }
...@@ -531,6 +550,7 @@ public class Layout { ...@@ -531,6 +550,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.centerHorizontally(v, child: child, offset: offset) Layout.centerHorizontally(v, child: child, offset: offset)
return self return self
} }
...@@ -557,6 +577,7 @@ public class Layout { ...@@ -557,6 +577,7 @@ public class Layout {
guard let v: UIView = parent else { guard let v: UIView = parent else {
return debugParentNotAvailableMessage() return debugParentNotAvailableMessage()
} }
self.child = child
Layout.centerVertically(v, child: child, offset: offset) Layout.centerVertically(v, child: child, offset: offset)
return self return self
} }
......
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