Latest 1.0.0
Homepage https://github.com/Meniny/MXSwiftKit
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit

MXSwiftKit is a bundle of utils of CocoaTouch in Swift (~> 2.1).

Installation with CocoaPods

pod 'MXSwiftKit'

Usage

  • Then Action
let aView = UIView().then {
    $0.backgroundColor = UIColor.redColor()
    $0.translatesAutoresizingMaskIntoConstraints = false
}
self.view.addSubview(aView)

self.view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[v]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["v": aView]))
self.view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[v]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["v": aView]))

Trouble Shooting

Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.

And, since Xcode 7.3 has some bug with inheriting, you may need to add some code like this:

extension UIView: MXThenAction {}
extension UILabel: MXThenAction {}
extension UIButton: MXThenAction {}
  // ... any class you want to use with ThenAction

Latest podspec

{
    "name": "MXSwiftKit",
    "version": "1.0.0",
    "summary": "A bundle of utils of CocoaTouch in Swift (~> 2.1).",
    "description": "The first stable version of MXSwiftKit, a bundle of utils of CocoaTouch.",
    "homepage": "https://github.com/Meniny/MXSwiftKit",
    "license": "MIT",
    "authors": "Elias Abel",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Meniny/MXSwiftKit.git",
        "tag": "1.0.0"
    },
    "source_files": "MXSwiftKit/*",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This