Skip to content

Commit

Permalink
Attempt padding modifier fusion
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxDesiatov committed Nov 7, 2020
1 parent 9681b91 commit f14f149
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/TokamakCore/Modifiers/PaddingLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,15 @@ extension View {
padding(.all, length)
}
}

extension ModifiedContent where Modifier == _PaddingLayout, Content: View {
public func padding(_ length: CGFloat) -> some View {
var layout = modifier
layout.insets?.top += length
layout.insets?.leading += length
layout.insets?.bottom += length
layout.insets?.trailing += length

return ModifiedContent(content: content, modifier: layout)
}
}

0 comments on commit f14f149

Please sign in to comment.