Giter VIP home page Giter VIP logo

popupmenuswift's Introduction

PopUpMenuSwift

Swift Package Manager compatible

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

Gifs

Installation

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

Usage

import PopUpMenuSwift
// Create any view.
let firstMenuView = Text("Light style")
    .foregroundColor(.black)
    .font(.custom("Seravek", size: 18))
    .padding(8)
    .background(.white)
    .cornerRadius(8)
    
let secondMenuView = Text("Dark style")
    .foregroundColor(.white)
    .font(.custom("Seravek", size: 18))
    .padding(8)
    .background(.black)
    .cornerRadius(8)
    
let thirdMenuView = Text("Custom style")
    .foregroundColor(.white)
    .font(.custom("Seravek", size: 18))
    .padding(8)
    .background(.pink)
    .cornerRadius(8)

// Create names for the dropdown menu.
let menuItems = [
    "First item. Do something on tapped on the item.",
    "Second item",
    "Third item",
    "Fourth item",
    "Fifth item"
]

// Create PopUp with light style (default).
PopUpMenuView(
    anyView: AnyView(firstMenuView),
    menuItems: menuItems
) { index in
    print("Dropdown index: \(index)")
}

// Create PopUp with dark style.
PopUpMenuView(
    anyView: AnyView(secondMenuView),
    menuItems: menuItems
) { index in
    print("Dropdown index: \(index)")
}
.popUpMenuStyle(.darkStyle)

// Create PopUp with custom style.
PopUpMenuView(
    anyView: AnyView(thirdMenuView),
    menuItems: menuItems
) { index in
    print("Dropdown index: \(index)")
}
.popUpMenuStyle(
    .customStyle(
        textColor: .white,
        itemBackgroundColor: .pink,
        backgroundColor: .pink.opacity(0.5)
    )
)

Note: Two or more PopUpMenuView on one screen work as a whole.

Sets the style of PopUpMenuView

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

.darkStyle
.customStyle

Requirements

License

  • PopUpMenuSwift is distributed under the MIT License.

popupmenuswift's People

Contributors

bullinnyc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.