Convenient View Extension collection.
if nil is given as NotificationName, it will be ignored. otherwise receive the notification.
SomeView()
.optionalOnReceive(notificationName: optionalNotificationName, action: { _ in print("called") })
if nil is given as publisher, it will be ignored. otherwise published event will be received.
SomeView()
.optionalOnReceive(publisher: optionalPublisher, action: { _ in print("called") })
for if-else modifier (but not only for)
SomeView()
.modify {
if #available(macOS 14, iOS 17, *) {
$0.onlyAvailableForMacOS14()
} else {
$0
// or $0.fallbackBelowMacOS13
}
}
Text("Hello")
.readSize() { geometryProxy in
// do what you want with GeometryProxy (for Text)
}
public func frame(_ size: CGSize)
public func anyView() -> AnyView
public func pushOutView()
let visible = false
SomeView()
.visible(visible)