Beautiful PopUpView
that supports portrait and landscape orientation, with flexible view settings.
Going to Xcode File
> Add Packages...
and add the repository by giving the URL https://github.com/bullinnyc/PopUpSwift
Enjoy!
import PopUpSwift
let singleLineExampleText = "Life is like a box of chocolates, you never know what you’re gonna get."
let multiLineExampleText = """
Life is like a box of
chocolates,
you never know what you’re gonna
get.
"""
// PopUp with light style (default).
PopUpView(
shape: .circle,
shapeColor: .mint,
text: singleLineExampleText
) {
print("Do something on tapped on the popup.")
}
// PopUp with custom style.
PopUpView(
shape: .heart,
shapeColor: .pink,
text: multiLineExampleText,
popUpType: .bottom
)
.popUpStyle(
.customPopUpStyle(
textColor: .white,
backgroundColor: .red
)
)
// PopUp with dark style.
PopUpView(
shape: .circle,
shapeColor: .white,
text: singleLineExampleText
) {
print("Do something on tapped on the popup.")
}
.popUpStyle(.darkPopUpStyle)
let singleLineExampleText = "Life is like a box of chocolates, you never know what you’re gonna get."
let multiLineExampleText = """
Life is like a box of
chocolates,
you never know what you’re gonna
get.
"""
// Create any view.
let image = Image("BrooklynBridge")
.resizable()
.aspectRatio(contentMode: .fill)
.clipShape(Circle())
.overlay(
Circle()
.stroke(.white.opacity(0.8), lineWidth: 0.9)
)
.frame(width: 60, height: 60)
// PopUp with light style (default).
PopUpView(
anyView: image,
text: singleLineExampleText
) {
print("Do something on tapped on the popup.")
}
// PopUp with custom style.
PopUpView(
anyView: image,
text: multiLineExampleText,
popUpType: .bottom
)
.popUpStyle(
.customPopUpStyle(
textColor: .white,
backgroundColor: .secondary
)
)
// PopUp with dark style.
PopUpView(
anyView: image,
text: singleLineExampleText
) {
print("Do something on tapped on the popup.")
}
.popUpStyle(.darkPopUpStyle)
PopUpView
Note: Default PopUp style is set to light
. You can try other styles or create your own style.
.darkPopUpStyle
.newYorkPopUpStyle
.customPopUpStyle
link |
Stars: 2 |
Last commit: 25 weeks ago |
Updated
any View
.Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics