Posts

How to see which version of Swift I'm using in Xcode?

Solution: Select your project -> Select the target ->select build Settings -> in search type "swift_version" then it will show your version you had used in your app.

Convert Int to String in Swift iOS

Solution: If you had an variable with datatypes like Int,Float,Double,Nsnumber or others then you can easily convert that into String using below method. String(describing:yourValue)

How to add a target to a button using selector iOS swift?

Solution:         Btn.addTarget( self , action: #selector (btnPressed), for: UIControlEvents.touchUpInside) btnpressed function implementation will be like below      func  btnPressed() { }

How to get a length of a string iOS swift?

Solution: The below functions are used for counting the number of characters in a particular string.     var yourString: String = "string count" If your string will be like above then Swift 4: yourString.count Swift 2: yourString. characters.count Swift 1: Count(yourString)

CVCalender disable autoDate selection when swipe months iOS swift

Solution: When using the CVCalender in pods try the below steps to avoid the auto date selection. 1)Search in your project workspace using the below keyword "matchedMonths". 2) In CVCalendarMonthContentViewController find the below lines if matchedMonths (current, presented) {                     selectDayViewWithDay (current. day , inMonthView: presentedMonthView)                 } else {                     selectDayViewWithDay ( CVDate (date: calendarView . manager                         . monthDateRange (presentedMonthView. date ).monthStartDate, calendar: calendar). day ,                                          inMonthView: presentedMonthView) ...

Carousel View in iOS swift

Solution: 1) First you have to download the carousalView using the below URL. https://github.com/nicklockwood/iCarousel 2) Open the examples folder and open swift3 Project using xcode. 3) Create folder named  iCarousel in your project. 4) IN the swift 3 example project find iCarousel.h and iCarousel.m files..Drag and drop those files to your project inside iCarousel folder. 5) Goto your project storyboard and create one UIView and select the class as iCarousel.Then create the outlet to your view.     @IBOutlet weak var carosalView: iCarousel ! class  ViewController:   UIViewController,iCarouselDataSource , iCarouselDelegate {      var   List : NSMutableArray ! = NSMutableArray ()     override func viewDidLoad() {          carosalView . type = . coverFlow } }     // MARK: - carousalViewDelegate ...

When i try to pop one view controller after push to that viewController not able to pop back iOS swift

Solution: When you push the viewController using animated true then you must pop the viewController by animated true. When push the Viewcontroller using animated false then pop the viewcontroller using false.It will works good. Animated true Push:  self.navigationController?.pushViewController(vc,  animated: true) Pop: self.navigationController?.popViewController(animated: true)  Animated false Push:  self.navigationController?.pushViewController(vc,  animated: false) Pop: self.navigationController?.popViewController(animated: false)