Skip to content

Commit

Permalink
Add documentation for SketchKitLayoutGuideDSL and SketchKitViewDSL
Browse files Browse the repository at this point in the history
  • Loading branch information
dogo committed Oct 21, 2020
1 parent a51e9cb commit e19ec8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/SketchKit/SketchKitLayoutGuideDSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import UIKit

public extension UILayoutGuide {

/// Property to access the SketchKitLayoutGuideDSL and be able to applyConstraints
var layout: SketchKitLayoutGuideDSL {
return SketchKitLayoutGuideDSL(layoutGuide: self)
}
}

/// SketchKitLayoutGuideDSL
public class SketchKitLayoutGuideDSL {

let layoutGuide: UILayoutGuide
Expand All @@ -22,6 +24,8 @@ public class SketchKitLayoutGuideDSL {
self.layoutGuide = layoutGuide
}

/// Apply all the constraints to a UILayoutGuide using SketchKitLayoutGuideDSL
/// - Parameter block: Block with all constraints to be applied to the current layoutGuide.
public func applyConstraint(_ block: ((UILayoutGuide) -> Void)) {
block(self.layoutGuide)
}
Expand Down
4 changes: 4 additions & 0 deletions Sources/SketchKit/SketchKitViewDSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import UIKit

public extension UIView {

/// Property to access the SketchKitViewDSL and be able to applyConstraints
var layout: SketchKitViewDSL {
return SketchKitViewDSL(view: self)
}
}

/// SketchKitViewDSL
public class SketchKitViewDSL {

let view: UIView
Expand All @@ -23,6 +25,8 @@ public class SketchKitViewDSL {
self.view = view
}

/// Apply all the constraints to a UIView using SketchKitLayoutGuideDSL
/// - Parameter block: Block with all constraints to be applied to the current layoutGuide.
public func applyConstraint(_ block: ((UIView) -> Void)) {
self.view.translatesAutoresizingMaskIntoConstraints = false
block(self.view)
Expand Down

0 comments on commit e19ec8d

Please sign in to comment.