Browsed by
Tag: swift 4

IOS best network image download library – SDWebImage , Swift 3/4

IOS best network image download library – SDWebImage , Swift 3/4

Sometimes network image doest not download and for that app may crash . To avoid this you can use SDWebImage library as like Picasso android library which will show a default placeholder image until file downloaded . To implement SDWebImage – Step 1 : paste the pod file in podfile of your project (If you don’t create pod file . create it with ‘pod init’ command in your project directory) pod ‘SDWebImage’, ‘~> 4.0’ Run command pod install Step 2…

Read More Read More

IOS Swift 3/4 show alert for specific time duration

IOS Swift 3/4 show alert for specific time duration

   let alert = UIAlertController(title: “”, message: “alert disappears after 30 seconds”, preferredStyle: .alert)             self.present(alert, animated: true, completion: nil)             // change to desired number of seconds (in this case3 0 seconds)             let when = DispatchTime.now() + 30             DispatchQueue.main.asyncAfter(deadline: when){                 // your code with delay          …

Read More Read More

Swift 3 / 4 get current location with location manager .

Swift 3 / 4 get current location with location manager .

Step – 1 :  First define LocationManager . And Current location of CLLocaion .   var manager = CLLocationManager() var currentLocation: CLLocation! Step 2 : In ViewDidController get Current location with location manager . That’s it .   manager.requestWhenInUseAuthorization()                  if (CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedWhenInUse ||             CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedAlways){             currentLocation = manager.location             print(“location is “, currentLocation.coordinate.latitude)…

Read More Read More