Closed Oschly closed 4 years ago
@Oschly Looking through this I was thinking it might be better to have all the layer modifier functions named layer
and their parameters different.
for example instead of
View()
.border(width: 10)
it could be
View()
.layer(borderWidth: 10)
Mainly thought this when I saw layer.backgroundColor.
and we already have
Also I'd feel better if these moved into their own extension file... CALayer+SwiftUIKit.swift
Also let's switch this to the develop branch too.
@Oschly Looks great! Could you merge in the latest of develop. After that I can merge it in.
Only question is why did you remove layer(backgroundColor:)
When I was referring View().background(color: .blue)
https://github.com/0xLeif/SwiftUIKit/blob/faba15f99f3726954f3330939868880b164a52d7/Sources/SwiftUIKit/Extensions/UIView%2BSwiftUIKit.swift#L238-L243
I still think we should have a layer modifier.
View().layer(backgroundColor: .red)
Thanks! I will move that method back within develop branch wtih rest of the modifiers.
I somehow understood that we don't need .layer(backgroundColor:)
as we have just .background(color:)
.
Moved to #110
Instead of using single layer modifier to edit view's layer:
We can use that syntax:
There's method named
layer()
left to give programmer more possibilities to work on layer than new methods allow to, but it's a rare case and shouldn't be used until needed.