Floating button
some time we need to fix the button on uiview so that it will not change their position and clicking on it , we can extra event also.
1: for that we need to take the help of third party library.
Download the class of : KCFloatingActionButton
2: Now its time to load into UIViewController
3: take a parent UIWindow
4: Now add to UIViewController class :
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | func layout(){          currentWindow = UIApplication.shared.keyWindow         let fab = KCFloatingActionButton(frame: CGRect(x: CGFloat(SCREEN_WIDTH - 80), y: CGFloat(SCREEN_HEIGHT - 180), width: CGFloat(50), height: CGFloat(50)))         fab.buttonColor = UIColor().HexToColor(hexString: accentColor)         fab.plusColor = UIColor.white;         fab.addItem(self.globalObjectCatalogProduct.languageBundle.localizedString(forKey: "sharetoother", value: "", table: nil), icon: UIImage(named: "icShare")){ item in             self.sharetoOther();         }         fab.addItem(self.globalObjectCatalogProduct.languageBundle.localizedString(forKey: "addyourreview", value: "", table: nil), icon: UIImage(named: "ic_add_review")){ item in           self.performSegue(withIdentifier: "addReviewSegue", sender: self)         }         fab.addItem(self.globalObjectCatalogProduct.languageBundle.localizedString(forKey: "addtowishlist", value: "", table: nil), icon: UIImage(named: "ic_wishlist_pdf")){ item in             self.addToWishlist();         }         fab.fabDelegate = self         fab.tag = 1300;         currentWindow?.addSubview(fab)     } | 
5: For removing we have to use:
| 1 2 3 4 |  override func viewWillDisappear(_ animated: Bool) {         currentWindow.viewWithTag(1300)?.removeFromSuperview();         currentWindow = nil     } | 
