Coder Social home page Coder Social logo

triforkswiftextensions's Introduction

TriforkSwiftExtensions

Carthage compatible

Framework with generic Swift extensions.

Installation

Carthage

github "trifork/TriforkSwiftExtensions" ~> 1.0.7

Contributing

  1. Fork
  2. Branch from either development (new features ๐Ÿ†•) or master (hot fixes ๐Ÿ”ฅ)
  3. Develop and write unit tests.
  4. Commit with great messages.
  5. Push when you are done.
  6. Create a pull request.

If you need more guidance, then read this.

Happy contributing! ๐ŸŽ‰

Feature list

  • Array:
    • Remove Element instances based on Equatable comparison.
    • forEach iteration with Element and index.
  • Bundle:
    • Compile date of the app.
    • Version and build number of the app.
    • Bundle name of the app.
    • Name of build configuration
  • Collection:
    • Safe index access on Collection objects, returning nil instead of performing index out of bounds crashes.
  • CGFloat:
    • Very important shortcuts for ฯ€ (๐Ÿฅง)
  • CGRect:
    • midPoint to return the middle point of the rect.
  • Data:
    • Conversion to String and hex String.
  • Date:
    • Convert to string according to specified DateFormatter.Style.
    • Convert to and from ISO8601 formatted strings.
    • isToday, isYesterday and isTomorrow.
    • Get midnight representation of a date instance.
  • Double:
    • Get as string with a maximum or exact number of significant digits.
  • Encodable:
    • Construct a dictionary containing all the values from an Encodable.
  • Float:
    • Get as string with a maximum or exact number of significant digits.
  • Optional:
    • Passing an Optional receiver into another function and returns the other functions result or nil.
    • Passing an Optional receiver into another function/closure as an unwrapped parameter.
    • Optional:
      • Check whether an optional string is nil or empty.
  • NSMutableAttributedString:
    • More simple interface to append strings with font and color to NSMutableAttributedString.
    • Constructor with line spacing.
  • NSObject:
    • Gets the name of an object's class as a String.
  • LAContext:
    • Gets the available type of biometric id, i.e. TouchID, FaceID or None.
  • String:
    • Base64 encoding and decoding.
    • Conversion to URL and Data.
    • URL encoding.
    • Check for regular expression matches.
    • Validate as phone number or email.
  • UIAlertController:
    • "OK" alert.
    • Presentation with custom tint color.
    • Add actions to alerts.
  • UIColor:
    • Creating UIColor instance directly from Zeplin format: "rgb 255 0 255"
  • UIApplication:
    • Open Apple Maps or Google Maps with an address.
    • Open URLs safe by asking if is can open the URL first.
    • Recursive search for the top most view controller.
  • UIDevice:
    • Get device model name.
  • UIEdgeInsets:
    • Construct insets with same distance at all edges.
  • UIView:
    • Create circled view.
    • Get current first responder.
    • Round corners on one edge of a view.
    • Perform shake animation.
  • UIScrollView:
    • Handle to set both contentInsets and scrollIndicatorInsets with one property!
  • UIStackView:
    • Remove all arranged subviews.
  • UIViewController:
    • Convenience function to present an "Okay-UIAlertController"
  • URL:
    • Adding query parameters to URL.
    • Getting values from query parameters in URL.

TSELogger

Some of the extension functions requires specific conditions (e.g. UIView.circle() needs a square view) and will write to the console using print if the requirements aren't met. If you have some custom logging in your project and want to catch the framework's errors it can be done by setting a custom log handler:

TSELogger.customLogErrorHandler = { (message: String) in
  //Handle message
}

Note: If the customLogErrorHandler property is set, the framework will not invoke print anymore - if you still want this it is your responsibility to invoke it in your custom closure.


TRIFORK

triforkswiftextensions's People

Contributors

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