Giter Club home page Giter Club logo

meli-card-drawer-ios's Introduction

Screenshot iOS

Bitrise CocoaPods CocoaPods downloads Twitter: @JohnSanzo

๐Ÿ“ฒ How to Install

Using CocoaPods

Edit your Podfile and specify the dependency:

pod 'MLCardDrawer'

Add MLCardDrawer as a dependency. Adding the following line in dependenciesvalue of your Package.swift.

  dependencies: [
    .package(url: "https://github.com/mercadolibre/meli-card-drawer-ios.git", from: "1.0")
  ]

๐ŸŒŸ Features

  • Easy to integrate
  • Card number, name, expiration date and CVV support (CardData protocol)
  • Card left and right image customization (CardUI protocol)
  • CVV support at front & back view
  • Card flip animation integrated
  • Shine card effect with MotionEffect ๐Ÿ”ฅ๐Ÿ”ฅ
  • Live card view updated while CardData protocol is edited
  • PCI compliance (We do not save anything)
  • Support for custom overlay background image
  • Support for custom gradient
  • Support remote images (optional)

๐Ÿ’ How to use

1 - Import into project

import MLCardDrawer

2 - Define CardHeaderController reference & your own container view.

// You can create your containerView by code or by storyboard/xib (as you like)
private var containerView: UIView = UIView()
private var cardDrawer: MLCardDrawerController?

3 - Init cardDrawer sending CardUI and CardData protocol as parameters.

cardDrawer = MLCardDrawerController(cardUIHandler, cardDataHandler)

4 - Call to setup and show method.

cardDrawer?.setUp(inView: containerView).show()

๐Ÿ’ก Advanced features

Show security code

Gif

// You can highlight the security code location. 
// If the security code is behind, the card will transition with flip animation.
cardDrawer?.showSecurityCode()

Show front card view

cardDrawer?.show()

๐Ÿ”ฅ Shine card support based on MotionEffect ๐Ÿ”ฅ

cardDrawer?.setShineCard(enabled: true)

๐Ÿ’ณ Card data structure and style customization

You can customize the data structure and style of your card.

๐Ÿ”  CardData protocol

Using CardData protocol to update the card display values.

@objc public protocol CardData {
    var name: String { get set }
    var number: String { get set }
    var expiration: String { get set }
    var securityCode: String { get set }
    @objc optional var lastDigits: String { get set}
}

๐ŸŽจ CardUI protocol

Using CardUI protocol to customize: position of security code, card background, font color, place holders, etc.

@objc public protocol CardUI {
    var cardPattern: [Int] { get }
    var placeholderName: String { get }
    var placeholderExpiration: String { get }
    var cardFontColor: UIColor { get }
    var cardBackgroundColor: UIColor { get }
    var securityCodeLocation: MLCardSecurityCodeLocation { get }
    var defaultUI: Bool { get }
    var securityCodePattern: Int { get }

    @objc optional func set(bank: UIImageView)
    @objc optional func set(logo: UIImageView)
    @objc optional var fontType: String { get }
    @objc optional var bankImage: UIImage? { get }
    @objc optional var cardLogoImage: UIImage? { get }
    @objc optional var ownOverlayImage: UIImage? { get }
}

๐ŸŽจ AddTagBottomProtocol protocol

Using addTagBottom protocol to customize: position bottom tag, background color, font color, place holders.

public protocol CapabilitiesComponentsViewProtocol: NSObject {
    func addTagBottom(containerView: UIView, isDisabled: Bool, cardType: MLCardDrawerTypeV3, tagBottom: Text?, padding: UIEdgeInsets)
}

๐Ÿ˜‰ Next steps

  • Bitrise for releases
  • Codebeat integration
  • Shine card effect with MotionEffect ๐Ÿ”ฅ๐Ÿ”ฅ
  • SwiftLint
  • Migration to Swift 5
  • Native support to display card in disabled mode (card disabled)
  • Version 2.0 SwiftUI compatible ๐Ÿ˜ˆ
  • Create a bottom tag capability

๐Ÿ”ฎ Project Example

This project include an example project using MLCardDrawer and another target with xCTests test cases. Enter to path: meli-card-drawer-ios/Example_MeliCardDrawer and run pod install command. After that, you can open Example_MeliCardDrawer.xcworkspace

๐Ÿ•ต๏ธโ€โ™‚๏ธ Test cases

TestCases

๐Ÿ“‹ Supported OS & SDK Versions

  • iOS 9.0+
  • Swift 4.2
  • xCode 9.2+
  • @Objc full compatibility

โค๏ธ Feedback

This is an open source project, so feel free to contribute. How? -> Fork this project and propose your own fixes, suggestions and open a pull request with the changes.

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Author

Juan Sanzone / @juansanzone

๐Ÿ‘ฎ๐Ÿป License

Copyright 2019 Mercadolibre Developers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

meli-card-drawer-ios's People

Contributors

andresmargalef avatar appseginf avatar augustocollerone avatar ccalcagnoml avatar cristiansc0794 avatar dependabot[bot] avatar douglaseiki avatar eboffa avatar ericertlmeli avatar giselaaramosc avatar github-actions[bot] avatar guimelii avatar ignaciososaml avatar itamarlourenco avatar jscaramal-meli avatar juansanzone avatar jventrilho avatar lelalesi avatar lucschmidt avatar matheusctmeli avatar mltheus avatar mvarani avatar pesilsa avatar rgrajalesmeli avatar rguarinoml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.