There are two ways to add click event in swift, through storyboard or programmatically. Click depends on type of widgets. If it’s a UIButton, then it can be easily done through storyboard but if it is UILabel, UIView or even a UIImageView then you can implement click in code using UITapGestureRecognizer. Let’s start with clickContinue reading “Swift -> Add tap gesture recognizer to views”
Tag Archives: iOS
Swift -> Show alert with alert action callback
Alerts are very important to show general/error information to user. In swift we can display alerts using UIAlertController. //This example is when there is no alert action required. You don’t want to capture user answer and just enable click on action items. This use case is important in conveying general information like “The sky isContinue reading “Swift -> Show alert with alert action callback”
Swift -> Get size of image in MB
Call a simple function passing url of the image you want the size of. Size can be calculated in KB, MB or GB. If you want the size in KB then divide it by 1000. If in GB divide it by 1000000000 (1e+9).
Swift -> Get current time in milliseconds
Happy Coding! 🙂