GithubHelp home page GithubHelp logo

bstillitano / segmentedbutton Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 196 KB

A segmented button designed to mimic the one seen in the Apple Maps app on iOS 13

License: Apache License 2.0

Ruby 16.60% Objective-C 8.13% Swift 75.27%
ios swift xcode ui button maps

segmentedbutton's Introduction

SegmentedButton

Welcome to SegmentedButton, a UI/UX framework for allowing users to quickly and easily insert a segmented button of sorts that replicates the split style button seen in the Apple Maps app on iOS 13.

License CocoaPods Compatible Twitter Platform

Features

  • Allows for an unlimited number of buttons
  • Buttons exist local to their scope and don't require any delegate conformance.
  • Super performant
  • Pre-built UI (shadows, rounded corners, etc)
  • Dark/Light mode support out of the box.

Usage

import SegmentedButton

class ViewController: UIViewController{
  
  func foo() {
    //Setup Location Button
    let locationButton: UIButton = UIButton()
    locationButton.tintColor = .white
    locationButton.setImage(UIImage(named: "ic_location")?.withRenderingMode(.alwaysTemplate), for: .normal)
    locationButton.addTarget(self, action: #selector(zoomMapToUserLocation), for: .touchUpInside)
    locationButton.contentEdgeInsets = UIEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0)

    //Setup Settings Button
    let settingsButton: UIButton = UIButton()
    settingsButton.tintColor = .white
    settingsButton.setImage(UIImage(named: "settingsIcon")?.withRenderingMode(.alwaysTemplate), for: .normal)
    settingsButton.addTarget(self, action: #selector(openSettings), for: .touchUpInside)
    settingsButton.contentEdgeInsets = UIEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0)

    //Setup Split Button View
    let splitButton: SplitButton = SplitButton(buttons: [locationButton, settingsButton])
    self.view.addSubview(splitButton)

    //Update Split Button Constraints
    splitButton.snp.makeConstraints { (make) in
        make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(16)
        make.right.equalToSuperview().inset(16)
    }
  }
}

Requirements

  • iOS 11.0+
  • Xcode 9.0+

Communication

  • If you need help, use Stack Overflow. (Tag 'segmentedbutton')
  • If you'd like to ask a general question, use Stack Overflow.
  • If you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Installation

Embedded frameworks require a minimum deployment target of iOS 11+.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate SegmentedButton's features into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'
use_frameworks!

pod 'SegmentedButton', '~> 0.1.0'

Then, run the following command:

$ pod install

Change Log

SegmentedButton is a growing project and will encounter changes throughout its development. It is recommended that the Change Log be reviewed prior to updating versions.

License

Licensed under Apache 2.0

Copyright (C) 2020, Ordermentum Pty Ltd All rights reserved.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

segmentedbutton's People

Contributors

bstillitano avatar

Stargazers

 avatar

Watchers

 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.