Skip to main content

Posts

Call phone Number In swift 3

//Here you can make method of calling functionality. func callNumber (yourP honeNumber : String ) { if let phoneCallURL = URL ( string : "tel://\(yourP honeNumber )" ) { let application : UIApplication = UIApplication . shared if ( application . canOpenURL ( phoneCallURL )) { application . open ( phoneCallURL , options : [:], completionHandler : nil ) } } } Happy Coding :)
Recent posts

Set gradients to button in swift 3

// Here is the Gradient method, You can edit your color as per requirements. func BtnClrmethod(btn: UIButton ) {         let gradientLayer: CAGradientLayer !         btn. layer . cornerRadius = 5         let greenClr = UIColor (red: CGFloat ( 38.0 / 255 ), green: CGFloat ( 122.0 / 255 ), blue: CGFloat ( 81.0 / 255 ), alpha: 1.0 )         let blueClr = UIColor (red: CGFloat ( 36.0 / 255 ), green: CGFloat ( 96.0 / 255 ), blue: CGFloat ( 159.0 / 255 ), alpha: 1.0 )         gradientLayer = CAGradientLayer ()         gradientLayer . frame = btn. bounds         gradientLayer . cornerRadius = 5         gradientLayer . colors = [greenClr. cgColor , blueClr. cgColor ]         btn. layer . addSublayer ( gradientLayer )     }         ...

Set Placeholder in UiTextView in swift 3

//In viewdidLoad add this                DiscriptionTV . text = "Discription"         DiscriptionTV . textColor = UIColor . lightGray         DiscriptionTV . delegate = self          DiscriptionTV . layer . borderColor = UIColor . lightGray . cgColor ; then   //Mark:- textView Delegates          func textViewDidBeginEditing( _ textView: UITextView ) {         if DiscriptionTV . textColor == UIColor . lightGray {             DiscriptionTV . text = nil             DiscriptionTV . textColor = UIColor . white             DiscriptionLab . isHidden = false         }     }          func textViewDidEndEditing( _ textView: UITextView ) { ...

Create ActionSheet and AlertView in swift 3

let  alertVC:  UIAlertController  = UIAlertController (title:  "Alert" , message:  "YOUR MESSAGE" , preferredStyle: .actiobSheet)    let  okBtn = UIAlertAction. init (title:  "Ok" , style: . default , handler: {  _   in                           // Perform whatever you want                          })     alertVC.addAction(okBtn)     self .present(alertVC, animated:  true , completion:  nil )

Create AlertController in swift 3

let alertVC: UIAlertController = UIAlertController (title: "Alert" , message: "YOUR MESSAGE" , preferredStyle: .alert)   let okBtn = UIAlertAction. init (title: "Ok" , style: . default , handler: { _ in                           // Perform whatever you want                         })     alertVC.addAction(okBtn)     self .present(alertVC, animated: true , completion: nil )

post method using alamofire in swift 3

  func addSubscriptionApi(_completeUrl: String ) {         //HUD         Alamofire.request(_completeUrl, method:.post, parameters: nil , encoding: JSONEncoding. default , headers: nil ).responseJSON { response in             switch (response.result) {             case .success( _ ):                 if let data = response.result.value as ? NSDictionary                 {                     print(response.result.value as Any)                     print(data)                      print("SUCCESS")                  }                 break  ...