In-House Articles
Understand UIResponder & Responder Chain to Handle Events
It is one of the most commonly asked interview questions in Swift and UIKit. UIResponder helps you communicate and handle the events in the app. Discover more about UIResponder in this week’s article.
Context Menus In SwiftUI
We all know about the menu that pops up when you long-press an app on the home screen or how a menu with a relevant options pops up when you long-press a photo in the gallery. That menu behaviour is called the context menu. Learn more about context menus in this week’s Swift Anytime article.
Ultimate Guide On Timer In Swift
Consider an instance where you have to send an OTP from your app and there is a “Resend” option. Think of a use case when a user is spamming the resend option an absurd amount of times. Something like this would end up overloading the server. A potential and most common way to fix it is by using a timer and only showing the “Resend” password option after certain seconds. Take a look at the Timer class in this week’s Timer Guide Article.
Recommended Articles
Analyze iOS App Binary size with Link Map
In order to analyze the size of an iOS app’s binary file, developers can use Xcode’s Link Map file. This file provides information on the size of the app’s code, resource files, and third-party frameworks.
Stable Diffusion with Core ML on Apple Silicon
OpenAI has released optimizations for its Stable Diffusion technology for on-device deployment in macOS 13.1 and iOS 16.2. Stable Diffusion, which can generate images from text prompts, is widely used by artists, developers, and hobbyists.
How to use FormatStyle to restrict TextField input in SwiftUI
In SwiftUI, a custom FormatStyle can be used to control the allowed characters in a TextField. This article presents a custom FormatStyle implementation that allows non-zero integers within a closed range, which can be used to avoid crashes in code.
Jobs
iOS Developer - Harman International
Location : Bengaluru & Pune, India
Company Description : As a technology leader that is rapidly on the move, HARMAN is filled with people who are focused on making life better. Innovation, inclusivity and teamwork are a part of our DNA. When you add that to the challenges they take on and solve together, you’ll discover that at HARMAN you can grow, make a difference and be proud of the work you do everyday.
SDE-III iOS Developer - Sequoia
Location : Bengaluru, India
Company Description : Sequoia comes through for clients with guidance, service, and the Sequoia People Platform. Through their compensation, benefits, and overall people programs, we enable them to better manage their global workforce, reduce administrative burdens, and reach a deeper level of employee care and support. They strategically use technology to enhance the expert guidance and committed service they bring to every client engagement.
SDE-II iOS Developer - BookMyShow
Location : Mumbai, India
Company Description : The company is currently India’s largest entertainment ticketing platform. BookMyShow started out in 1999 as a software re-seller for movie theaters and converted into a platform catering to cloud-based ticket booking of events, movies, sports, and plays. BookMyShow was known by the name of its parent company, Bigtree Entertainment Pvt. Ltd., at the time of its inception.
Let's meet in Bangalore
After the great success of Swift Anytime Delhi Meetup, we are excited to bring you the 2nd chapter of Swift Anytime Meetup & this time we are coming to the Silicon Valley Of India - Bangalore.
🗓 17th Dec 2022 |📍 Bangalore
Thanks to our sponsors Codemagic
Cracking the iOS Interview
What is the difference between classes and structs?
- The difference between a class and a struct is whether it’s a reference or a value. If you need to store some primitive data types (i.e. Ints, Floats, Strings, etc.), use a struct.
- However, if you need custom behaviour where passing by reference is preferred so that you refer to the same instance everywhere, use a class.
- The other difference is that a class supports inheritance, while a struct doesn’t.
Note: Basically in Swift, a struct is preferred over a class.
Why should a lazy property be a variable not a constant in Swift?
You must always declare a lazy property as a variable (with the var
keyword) because its initial value might not be retrieved until after the instance is initialized. Constant properties must always have a value before the initialization completes, and therefore shouldn’t be declared lazy.
iOS Good Practices
Specify your app’s colors using asset catalogs
It is a little-known feature of Xcode asset catalogs that allows you to add colors directly. Just like images, color literals can be defined and used throughout the app and referred to as images.
The major benefit of using colors in the Assets catalog is that you can define a color in light and dark modes based on your requirements.
This is how you can access the colors defined using assets:
let primaryTextColor = UIColor(named: "PrimaryTextColor")
let secondaryTextColor = UIColor(named: "SecondaryTextColor")
Code Quiz
Which of the following is not true about the lazy property?
- You can define a lazy property by
lazy var variableName...
- It should be used as computationally expensive code.
- This value is calculated every time.
- Lazy properties are mutable.
Solve the quiz and submit your answer along with your Twitter handle at team@swiftanytime.com