Yalantis / FoldingTabBar.iOS

Folding Tab Bar and Tab Bar Controller
https://yalantis.com
MIT License
3.68k stars 459 forks source link

Swift update #41

Closed SketchySwift closed 8 years ago

SketchySwift commented 8 years ago

Please update this to swift or create a tutorial on how to use it with swift!

avicooper1 commented 8 years ago

This is my implementation is Swift:

 let tabBarController = self.window?.rootViewController as! YALFoldingTabBarController

 let item1 = YALTabBarItem(itemImage: UIImage(named: "YourImage1"), leftItemImage: nil, rightItemImage: nil)
 let item2 = YALTabBarItem(itemImage: UIImage(named: "YourImage2"), leftItemImage: nil, rightItemImage: nil)
 let item3 = YALTabBarItem(itemImage: UIImage(named: "YourImage3"), leftItemImage: nil, rightItemImage: nil)
 let item4 = YALTabBarItem(itemImage: UIImage(named: "YourImage4"), leftItemImage: nil, rightItemImage: nil)

 tabBarController.tabBarView.offsetForExtraTabBarItems = YALForExtraTabBarItemsDefaultOffset
 tabBarController.leftBarItems = [item1, item2]
 tabBarController.rightBarItems = [item3, item4]
 tabBarController.centerButtonImage = UIImage(named: "PlusIcon")
 tabBarController.tabBarViewHeight = 80.0
 tabBarController.tabBarView.backgroundColor = UIColor.clearColor()
 tabBarController.tabBarView.extraTabBarItemHeight = 60.0
 tabBarController.tabBarView.tabBarViewEdgeInsets = YALTabBarViewHDefaultEdgeInsets
 tabBarController.tabBarView.tabBarItemsEdgeInsets = YALTabBarViewItemsDefaultEdgeInsets
SketchySwift commented 8 years ago

Can you send me your project please!

SketchySwift commented 8 years ago

I don't know how to use it completely with swift!

avicooper1 commented 8 years ago

I can't share my project but I can try to solve your problem. The only issue I had was with translating this line: YALFoldingTabBarController *tabBarController = (YALFoldingTabBarController *) self.window.rootViewController; but I have given the solution above. All the other instructions should be in the README.

SketchySwift commented 8 years ago

How come you can't share your project? :(

SketchySwift commented 8 years ago

could you create a repo?