🌀view + .frame()
╱🚧 under construction -> 準備作廢
// 2022.02.14 + (method) .frame(cgfloat)
import SwiftUI
// 🌀View+frame()
extension View {
/// Examples:
/// ```
/// view.frame(size)
/// view.frame(nil)
/// ```
public func frame(_ size: CGSize?, alignment: Alignment = .center) -> some View {
frame(width: size?.width, height: size?.height, alignment: alignment)
}
/// `view.frame(w, h)`
public func frame(_ width: CGFloat, _ height: CGFloat) -> some View {
frame(width: width, height: height)
}
/// `view.frame(cgfloat)`
public func frame(_ size: CGFloat) -> some View {
frame(width: size, height: size)
}
}
History
2020.10.12:✏️ .frame(_ size:CGSize) 改為 CGSize?
2022.02.07: / 簡化 .frame(size) 語法。
Last updated
Was this helpful?