Swiftpack.co - bullinnyc/PopUpSwift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by bullinnyc.
bullinnyc/PopUpSwift 1.3.0
Beautiful PopUpView that supports portrait and landscape orientation, with flexible view settings.
⭐️ 2
🕓 45 weeks ago
iOS
.package(url: "https://github.com/bullinnyc/PopUpSwift.git", from: "1.3.0")

PopUpSwift

Swift Package Manager compatible

Beautiful PopUpView that supports portrait and landscape orientation, with flexible view settings.

Gifs

Screenshots

Installation

Swift Package Manager

Going to Xcode File > Add Packages... and add the repository by giving the URL https://github.com/bullinnyc/PopUpSwift
Enjoy!

Usage

import PopUpSwift

Quick start with use ready-made shapes

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)

Start with custom view

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)

Sets the style of PopUpView

Note: Default PopUp style is set to light. You can try other styles or create your own style.

.darkPopUpStyle
.newYorkPopUpStyle
.customPopUpStyle

Requirements

License

  • PopUpSwift is distributed under the MIT License.

GitHub

link
Stars: 2
Last commit: 45 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.3.0
45 weeks ago

Updated

  • Changed the type for the anyView parameter to any View.
  • Updated README.md

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics