Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Esqarrouth committed Dec 19, 2015
2 parents ce3cfdb + 8d208c0 commit 9bc51ba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ override func viewDidAppear(animated: Bool) {

dismissVC(completion: nil) // Instead of dismissViewControllerAnimated(true, completion: completion)}
```

Easily add UIViewControllers:

``` swift
let myViewController = myViewController()
addAsChildViewController(myViewController, toView: self.anySubview) // Adding view controller as a child view controller to subview
```

##UIView Extensions

Easily initialize your objects:
Expand Down
6 changes: 6 additions & 0 deletions Sources/EZSwiftExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import UIKit

public struct ez {

/// EZSwift Extensions
public static var appDisplayName: String {
return NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleDisplayName") as? String
?? NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleName") as! String
}

/// EZSwift Extensions
public static var appVersion: String {
return NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as! String
Expand Down
8 changes: 8 additions & 0 deletions Sources/UIViewControllerExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,13 @@ extension UIViewController {
public func dismissVC(completion completion: (() -> Void)? ) {
dismissViewControllerAnimated(true, completion: completion)
}

/// EZSwiftExtensions
public func addAsChildViewController(vc: UIViewController, toView: UIView){
vc.view.frame = toView.frame
toView.addSubview(vc.view)
self.addChildViewController(vc)
vc.didMoveToParentViewController(self)
}
}

0 comments on commit 9bc51ba

Please sign in to comment.