The collection is something which is used by almost everyone. It makes our life easy. List
, Set
and Map
are the best examples of them.
The collection is something which is used by almost everyone. It makes our life easy. List
, Set
and Map
are the best examples of them.
The collection is something which is used by almost everyone. It makes our life easy. List
, Set
and Map
are the best examples of them.
Rounding up to the nearest Integer value functionality is something required a lot of times. Kotlin has a few inbuilt functions which can do the rounding up for us but they are a bit confusing. To decide when to use what, we need to understand which rounding function rounds up in which direction and which data types it can round up.
…Swift has two data types (Double and Float) to hold the decimal values. Both of them hold the same decimal type values but have some differences.
…For-in and for-each are different variants of for loops in swift which are used to iterate over a range, set or dictionary. Both provide the same functionality but has a few limitations or differences when it comes to conditional access.
…In continuation to my previous blog UserDefaults in Swift, where we understand the basic functionality of UserDefaults, we’ll try to understand today how can we store custom objects in UserDefaults.
…A small set of data is required to be stored and accessed very frequently and need to be persisted across sessions or app launches. One way of keeping them is using a local database like core data in an iOS app. But core data is helpful in the case of tables and queries. There is another way to store a small set of data, UserDefaults.
…Adding an value change event to a UISwitch
is something that is required most of the time. For views like UISwitch
, we can connect an IBAction
with the event type as value changed
and get a callback for the value changed.
Adding an editing event to a UIDatePicker
is something that is required most of the time. For views like UIDatePicker
, we can connect an IBAction
with the event type as value changed
and get a callback for the value changed.
Adding an editing event to a UITextField
is something that is required most of the time. For views like UITextField
, we can connect an IBAction
with the event type as editing did end
or value changed
and get a callback for editing finished or value changed.
The switch statement in Swift is used to execute a particular block of code based on multiple conditions. A switch statement is useful for more than one condition. For one or two conditions, if-else
is a better option but for conditions more than that, a switch
statement is a better option.
Range Operator in Kotlin is a basic operator that is used to operate over a range. A range can be defined with a start value and an end value with and without inclusion.
…Collections (Sets
, Maps
and Lists
) are something we use daily. Traversing (Iteration) is the most common operation we perform over any collection.
Range Operator in Swift is a basic operator that is used to operate over a range. There are multiple types of range operators where we can include or exclude the upper range. Or we can start the range with some value or can end before some max value. The range operators can be used with for loops, if conditions, switch conditions or even in array iteration. First, let to see a basic example of a range operator.
…For loops are used by every developer regularly. There is for-in as well as a for-each loop in Swift which has a bit different syntaxes. Both of them are used to iterate over a range, array, set or dictionary but have a bit different syntaxes.
…Object creation is a heavy process. When we create a class object, all the public and private properties of that class are initialised inside the constructor. Every variable inside a class initialisation requires a certain amount of time to allocate the memory on the heap and hold its reference on the stack. The more variables, the more time it may take but since the time is in microseconds or even less, it’s not observable.
…Since object creation is a heavy process as it initialises all the public and private properties defined in that class when the constructor is called, Kotlin has few ways to initialise properties later when required. We already discussed lateinit properties and lazy properties.
…Object creation is a heavy process. When we create a class object, all the public and private properties of that class are initialised inside the constructor. Every variable inside a class initialisation requires a certain amount of time to allocate the memory on the heap and hold its reference on the stack. The more variables, the more time it may take but since the time is in microseconds or even less, it’s not observable.
…In continuation to my previous blog Native Android text sharing in Unity, where we learnt about sharing text from a Unity app targeting the Android platform, let’s try to learn about how can we receive a text from other apps. Accepting a text from other apps is not that common but sometimes location-based games required to accept text or location shared from other apps. There can be a generic use case also where we want to accept some text from other apps for any purpose.
…