DSToast
是一个简单提示框, 支持,MacOS
,iPhone
,iPad
.
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler
dependencies: [
.package(url: "https://github.com/swp-song/DSToast.git", .upToNextMajor(from: "1.1.0"))
]
dependencies: [
.package(url: "https://gitee.com/dream-swp/DSToast.git", .upToNextMajor(from: "1.1.0"))
]
import DSToast
@ObservedObject var `default` = DSToast.Data(title: "`Default`", message: "`Default Message`")
@ObservedObject var bottom = DSToast.Data(model: DSToast.Molde(title: "`Center`", message: "`Center Message`", textAlignment: .center, alignment: .vertical), position: .bottom)
var body: some View {
HStack (spacing: 30) {
Button("`default`") {
withAnimation {
self.default.config.isHidden = false
}
}
Button("`bottom`") {
withAnimation {
self.bottom.config.isHidden = false
}
}
}
.padding()
.dsToast(self.default)
.dsToast(self.bottom.config.isHidden) {
DSToast(data: bottom)
}
#if os(macOS)
.frame(maxWidth: .infinity, maxHeight: .infinity)
#endif
}
}