Latest 0.1.9
Homepage https://github.com/tanakorn-dev/CyberseSwift
License MIT
Platforms ios 10.0
Authors

CI Status
Version
License
Platform

Requirements

Installation

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

pod 'CyberseSwift'

And import CyberseSwift into the class that wants to make use of the library.

import CyberseSwift

Example

Color Function

  • UIColorFromRGB
self.backLabel.textColor = ColorFunction.colorFromRGB(rgbValue: 0xbb3af4)

Text Function

  • numberToCurency
self.number01.text = TextFunction.numberToCurency(amount: 3)  // return 3.00
self.number02.text = TextFunction.numberToCurency(amount: 3.3)  // return 3.30
self.number03.text = TextFunction.numberToCurency(amount: 3.33)  // return 3.33
self.number04.text = TextFunction.numberToCurency(amount: 3000)  // return 3,000.00
self.number05.text = TextFunction.numberToCurency(amount: 3.3333)  // return 3.33

Image Function

  • resizeImageSquare
let newImage01 = ImageFunction.resizeImageSquare(image: UIImage(), newSize: 20)  // New image size = 20x20
  • resizeImageCustom
let newImage02 = ImageFunction.resizeImageCustom(image: UIImage(), width: 100, height: 50)  // New image size = 100x50

Phone Number Function

  • phoneNumberStringStyle
print(PhoneNumberFunction.phoneNumberStringStyle(phoneNumberString: "0901234567")) // 090 123 4567
print(PhoneNumberFunction.phoneNumberStringStyle(phoneNumberString: "1443")) // 1443
print(PhoneNumberFunction.phoneNumberStringStyle(phoneNumberString: "123ABC")) // WRONG FORMAT

Validate Function

  • isEnglishName
// First Naame
print("(ValidateFunction.isEnglishName(textString: "AbcTccc", isFirstname: true))") // True
print("(ValidateFunction.isEnglishName(textString: "Abc Tccc", isFirstname: true))") // True
print("(ValidateFunction.isEnglishName(textString: "Abc123", isFirstname: true))") // False
print("(ValidateFunction.isEnglishName(textString: "Abcธงชัย", isFirstname: true))") // False

// Last Name
print("(ValidateFunction.isEnglishName(textString: "AbcTccc", isFirstname: false))") // True
print("(ValidateFunction.isEnglishName(textString: "Abc Tccc", isFirstname: false))") // False
print("(ValidateFunction.isEnglishName(textString: "Abc123", isFirstname: false))") // False
print("(ValidateFunction.isEnglishName(textString: "Abcธงชัย", isFirstname: false))") // False
  • isEmail
print("(ValidateFunction.isEmail(candidate: "[email protected]"))") // True
print("(ValidateFunction.isEmail(candidate: "[email protected]"))") // True
print("(ValidateFunction.isEmail(candidate: "[email protected]"))") // False
print("(ValidateFunction.isEmail(candidate: "[email protected]"))") // False
print("(ValidateFunction.isEmail(candidate: "abcd"))") // False

Phone code Function

  • withCountryCode
    print("(PhoneCodeFunction.withCountryCode(countryCode: "TH"))") // 66
    print("(PhoneCodeFunction.withCountryCode(countryCode: "AW"))") // 297

Credit Card Function

  • creditCardStringStyle

    print(CreditCardFunction.creditCardStringStyle(creditCardString: "1234567890123456")) // 1234 5678 9012 3456
  • expDateStyle
    print(CreditCardFunction.expDateStyle(expDateString: "0221")) // 02/21

Author

tanakorn-dev, [email protected]

License

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

Latest podspec

{
    "name": "CyberseSwift",
    "version": "0.1.9",
    "summary": "CyberseSwift is all function for swift.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/tanakorn-dev/CyberseSwift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tanakorn Phoochaliaw": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tanakorn-dev/CyberseSwift.git",
        "tag": "0.1.9"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "CyberseSwift/Classes/**/*"
}

Pin It on Pinterest

Share This