Giter Site home page Giter Site logo

devtorextension's Introduction

DevtorExtension

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

UIImageView

Circle imageView

imageView.circleImageView(borderColor: .black, borderWidth: 1)

Download image from URL

Without caching (default)

imageView.downloaded(from: "https://example.com/image", contentMode: .scaleToFill)

With caching

imageView.downloaded(from: "https://example.com/image", contentMode: .scaleToFill, cache: true)

UIImage

Base 64

Set image from base64

imageView.imageFromBase64(base64: base64_string)

Get base64 string from image (JPEG)

imageView.image.base64(format: .jpeg(100), completion: { base64 in
print("Your base64 string is \(base64)")
})

Get base64 string from image (PNG)

imageView.image.base64(format: .png, completion: { base64 in
print("Your base64 string is \(base64)")
})

OR without completion

imageView.image.convertImageTobase64(format: .jpeg(100))

imageView.image.convertImageTobase64(format: .png)

Image resizing

By percentage

imageView.image.resizeWithPercent(percentage: 50)

By width

imageView.image.resizeWithWidth(width: 120)

Scale image to new size

imageView.image.scaleImageToSize(width: 800, height: 400)

Image resizing

By percentage

let newImage = imageView.image.imageWithColor(color: .black)

UIColor

You can use Material Colors, Metro Colors, Flat Colors, Social Colors(Facebook, LINE, etc.) with very simple way! You can go to MaterialUI for reference.

Example

let colorGreen = UIColor.Material.Green.primary

Get color from hex

UIColor(netHex: 0xffa140)

Set color to darker

color.darker(by: 30)

Set color to lighter

color.lighter(by: 30)

Color from image

image.averageColor()

String

Data validation

Thai citizen ID

string.verifyCitizenID()

Mobile number

This function will check this number is valid or not and return Thai Mobile number validation result also.

Thailand Mobile number : 06, 08, 09 Thailand Phone number: 02, 03, 04, 05, 07

string.verifyMobileNumber()

Alphanumeric validation (Number and Alphavbet)

string.isAlphanumeric()

Number validation

string.isNumber()

Convert to Format

Thai citizen ID

x-xxxx-xxxxx-xx-x

string.toCitizenIDFormat()
Citizen ID with secure format

0-0000-xxxxx-xx-0

string.hideCitizenID()

You also can custom dialog with your character like this.

Default is "-"

string.hideCitizenID(character: "-")

Mobile number

xxx-xxx-xxxx

string.toMobileNumberFormat()

You also can custom dialog with your character like this.

Default is "-"

string.toMobileNumberFormat(character: "-")
Mobile number with secure format

000 xxx xx00

string.hideMobileNumber()

You also can custom dialog with your character like this.

Default is "-"

string.hideMobileNumber(character: "-")

Passport secure format

10 digits: yy-xxxxxxx 9 digits: yx-xxxxxx 8 digits: yx-xxxxx 7 digits: xx-xxxx

string.hidePassport()

Paperang Mac address

This function support only Paperang printer. XX:XX:XX:XX:XX:XX

string.toPaperangMacAddressFormat()

QR Code

string.toQRCode()

Barcode (Code128)

string.toBarcode()

Navigation Controller

Remove hair line

NavigationController.removeHairLine()

Add image

NavigationController.addImageToNavigationBar(titleImage: UIImage())

Requirements

  • iOS 10.0+
  • Swift 4.0+

Installation

DevtorExtension is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DevtorExtension'

Author

Feem.io

License

DevtorExtension is available under the MIT license. See the LICENSE file for more info.

devtorextension's People

Contributors

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