Swiftpack.co - Package - ivabra/IBSwiftToolKit

IBSwiftToolKit contains a lot useful extensions, functions and custom operators.

You can use CocoaPods to integrate library with your project:

 pod 'IBSwiftToolKit', :git => 'https://github.com/ivabra/IBSwiftToolKit'

Functions

  • Init(object, setup) - initializer pattern.
var view = Init(UIView) {[unowned self] in
	$0.backgroundColor = UIColor.whiteColor();
	self.view.addSubview($0)
}

Operators

  • =! - unsafe type casting operator. Instead var a: T = b as! T you can use var a: T =! b.
  • =? - safe type casting operator. Instead var a: T = b as? T you can use var a: T =? b.

Foundation

  • NSAttributedString
public convenience init(attributeStrings: AnyObject...)
  • NSDateFormatter
public convenience init(format: String)
  • NSObject
public func asOption<T>(type: T.Type) -> T?
public func asUnwrappedOption<T>(type: T.Type) -> T!
public func asType<T>(type: T.Type) -> T
  • NSRange
public init(location: Int, length: Int)

public init(_ location: Int, _ length: Int)

public init(range: Range<Int>)

public init(_ range: Range<Int>)

Swift

  • Array
public mutating func withoutItemsAtIndexesInPlace(indexes: [Int]) -> [Element]

public mutating func withItemsAtIndexesInPlace(indexes: [Int])

public func arrayWithoutItemsAtIndexes(indexes: [Int]) -> [Element]

public func arrayWithItemsAtIndexes(indexes: [Int]) -> [Element]
  • Int
public var Double: Double { get }
public var kilobytes: Double { get }
public var megabytes: Double { get }
public var gigabytes: Double { get }
  • String

public var image: UIImage { get }

public func createViewController<T : UIViewController>(storyboard: UIStoryboard, _ type: T.Type) -> T?

public func like(regex: String) -> Bool

public func firstMatchingRegexpPattern(pattern: String) -> String?

public func allCharactersInSet(set: NSCharacterSet) -> Bool

public func oneOrMoreCharactersInSet(set: NSCharacterSet) -> Bool

public func attributed(attrs: [String : AnyObject]) -> NSAttributedString

public var stringByDeletingPathExtension: String { get }

public init?(json: [NSObject : AnyObject])

public func hasCharacter(ch: Character) -> Bool

public func stringByappendingURLParameter(parameter: String, withValue value: String) -> String

public func stringByAppendingURLParameters(paramValueDictionary: [String : AnyObject]) -> String

public func formatDate(date: NSDate) -> String

public func dateWithFormat(format: String) -> MSDate?

public func format(args: CVarArgType...) -> String

public func NSRangeOfString(string: String) -> NSRange?

public var clearedURLString: String { get }

public var localized: String { get }

public func localized(comment comment: String) -> String

public func localizedFormat(arguments: CVarArgType...) -> String

CoreGrahics

  • CGAffineTransform
public func scaled(x x: CGFloat, y: CGFloat) -> CGAffineTransform
public func translated(x x: CGFloat, y: CGFloat) -> CGAffineTransform
public func rotated(angle: CGFloat) -> CGAffineTransform
public func inverted() -> CGAffineTransform

public mutating func translate(x x: CGFloat, y: CGFloat)
public mutating func scale(x x: CGFloat, y: CGFloat)
public mutating func rotate(angle: CGFloat)
public mutating func invert()
public mutating func identity()
  • CGColor
public var UIColor: UIColor { get }
  • CGImage
public func CGImageResize(image: CGImage, _ size: CGSize) -> CGImage!
  • CGPoint

public let CGAnchorPointCenter: CGPoint
public let CGAnchorPointCenterLeft: CGPoint
public let CGAnchorPointCenterRight: CGPoint
public let CGAnchorPointBottomCenter: CGPoint
public let CGAnchorPointBottomLeft: CGPoint
public let CGAnchorPointBottomRight: CGPoint
public let CGAnchorPointTopLeft: CGPoint
public let CGAnchorPointTopRight: CGPoint
public let CGAnchorPointTopCenter: CGPoint

public func +(left: CGPoint, right: CGPoint) -> CGPoint
public func -(left: CGPoint, right: CGPoint) -> CGPoint
public func *(left: CGPoint, right: CGPoint) -> CGPoint
public func /(left: CGPoint, right: CGPoint) -> CGPoint

  • CGRect

public var topLeft:      CGPoint { get }
public var topCenter:    CGPoint { get }
public var topRight:     CGPoint { get }
public var centerLeft:   CGPoint { get }
public var center:       CGPoint { get }
public var cetnerRight:  CGPoint { get }
public var bottomLeft:   CGPoint { get }
public var bottomCenter: CGPoint { get }
public var bottomRight:  CGPoint { get }

UIKit

  • UIAlertViewController
public class func presentAlertWithTitle(
	title: String?, 
	andMessage message: String?, 
	andPreferredStyle style: UIAlertControllerStyle, 
	withCancelTitle cancel: String?, 
	andActionTitle action: String?, 
	andActionStyle 
	actionStyle: UIAlertActionStyle,
	inViewController controller: UIViewController, 
	withActionBlock block: () -> ())

public convenience init(title: String, error: NSError?, unknownErrorDescription unknown: String = default)
  • UIBarButtonItem
 @IBInspectable public var localizeableTitle: String? { get set }
  • UIButton
public var titleForNormalState: String? { get set }

public var titleForDisabledState: String? { get set }

public var titleForSelectedState: String? { get set }

public var titleForHighlightedState: String? { get set }

@IBInspectable public var localizeableNormalTitle: String? { get set }
  • UIDevice
public var userInfo: [String : AnyObject] { get }
  • UISearchBar
@IBInspectable public var localizeablePlaceholder: String? { get set }
  • UISegmentControl
public func setLocalizeableTitle(localizeableTitle: String, forSegmentAtIndex index: Int)
  • UIView
@IBInspectable public var cornerRadius: CGFloat { get set }

@IBInspectable public var borderWidth: CGFloat { get set }

@IBInspectable public var borderColor: UIColor? { get set }

@IBInspectable public var shadowOffset: CGSize { get set }

@IBInspectable public var shadowOpacity: Float { get set }

@IBInspectable public var shadowRadius: CGFloat { get set }

@IBInspectable public var shadowColor: UIColor? { get set }

@IBInspectable public var _clipsToBounds: Bool { get set }

public func translate(x x: CGFloat, y: CGFloat)

public func scale(x x: CGFloat, y: CGFloat)
  • UIViewController
public func findOutputSeguesWithClassNameContains(className: String) -> [IBSwiftToolKit.StoryboardSegueTemplate]

public func presentErrorViewController(error: NSError?, title: String = default, okButton: String = default, animated: Bool = default, completion: (() -> Void)? = default)

public func addChildViewController(controller: UIViewController, toView view: UIView)

public func removeFromParentViewControllerCompletely()

@IBInspectable public var localizeableTitle: String? { get set }

public func parentViewControllerWithClass<T : UIViewController>(class: T.Type) -> T?
  • UIResponsder
 public class func currentFirstResponder() -> UIResponder?

Github

link
Stars: 2

Dependencies

Used By

Total: 0

Releases

Swift Package Manager integration - 2020-01-02 20:22:03

Swift 4 - 2017-09-17 13:49:20

v0.0.8 - 2016-04-02 11:14:00

0.0.7 - 2016-03-31 13:56:57