Overview? With iOS 13 and above people can adopt a dark appearance where Apple docs says user can use settings to make their devices automatically switch to dark mode when ambient is low and this will help you to put focus on your content.
Development Environment? As as iOS developer you’ve to use Xcode 11 with iOS 13 SDK and above, iOS will automatically update system controls such as switches, collection-views etc. If you are migrating your existing app to dark in that case you will have to adapt the colours.
How to define colours for each mode?
System Colours? iOS 13 SDK includes new system colours so if you adapt these system colours your app will automatically support dark and light mode, You can use it via Storyboard as well as programmatically (Some example below)
Custom Colors? Yes it’s strongly recommended by Apple that use system colours to provide better UX and also to make sure the consistency across apps but using the asset you can define you colour choices. Once you define iOS will take care everything for you.
How to define Image for each mode?
Using the Assets you can specify which image you want to use for dark VS any other mode and just define the image and let iOS take care for you.
How to detect dark mode programmatically?
On Load Detection? We can use overrideUserInterfaceStyle to check which mode is currently running on user device (Just make sure, this property only available on iOS 13 and above)
Runtime Detection? Can use traitCollectionDidChange to observe the changes, It is important to remember that trait-collection may be called for other trait changes (such as device rotation)
Set Dark Mode for Specific Screen? Yes you can, this property overrideUserInterfaceStyle is available for you to use (only iOS 13 and above)
Swift is fast, safe and expressive language to code with great full stack potential and community support. According to Apple, it’s 2.6 times faster than Objective C (As a Swift Developer I agree on this too 🙌). It’s 6th most loved language on StackOverflow.
ABI Background As a developer, I hope sometimes you also felt that Swift is not mature enough as every year major changes are being introduced. One of the key problems articulated by a lot of developers is “Lack of backward compatibility” and you have to choose one Swift version for your Xcode projects (Version lock). Resulting in with a new Swift release you have to make changes in your existing code.
What is ABI? ABI stands for Application Binary Interface. During runtime, Swift program interacts with other libraries through ABI (low-level set of protocols for memory representation, function calls, and access). So when I say ABI not stable it means that each binary is building its own version of Swift Dynamic Library inside it. Now the Swift 5 is ABI Stable which means if I build two apps, one using Swift 5.0 and another using Swift 5.2, both will use Swift ABI embedded in the iOS Operating System.
Why ABI Stability matters a lot?
Compatibility: which means new compilers can compile your old Swift code which means no more migration pain.
Bundle Size: It will reduce the build size because of no Swift standard Library in your Framework folder.
Binary framework and runtime compatibility which enables the framework distribution as a binary which will work across multiple Swift versions.
Conclusion: Swift is the future for Apple ecosystem and now it’s ABI stable which means, in other words, it is like write once and use everywhere.
The design is more often seems to when it comes to structures and low-level decisions whereas Architecture is often used in the context of something at the high level where we can see how components are connected with each other. But for starters, there is no different at all.
What is the GOAL of good software design?
The goal of software architecture is to minimize the Human Resources required to build and maintain the required system (By Uncle Bob Martin)
Basic fundamentals measure the design?
The measure of design quality is simply the measure of the effort required to meet the needs of the customer if the effort is low and stays same through the lifetime, System design is good else it’s bad.
The Signature of a system design mess?
Developer point of view
The graph says developers started with nearly 100% of productivity but with each release, their productivity going down
Executive point of view? Release 1 was delivered with a few hundred thousand payrolls and by the time of 5 release, it’s going to touch $500,000.
What is going wrong?
The moral of the story says everything in one line: “Slow and steady wins the race”. Yes, it all because of overconfidence. Everyone wants to hit the market first or release the app asap with the statement “We can clean it up later” and they can’t go back for cleaning the things up because now we have the new feature, new release so maybe next time, next time and next time.
The only way to go fast is to go well.
To take the software architecture seriously we have to think and need to know what good software architecture is, compare the different architecture with the requirements.
Thanks for reading it, if you want to read in more detail, buy “Clean Architecture by Robert C. Martin”
An enumeration defines a common type for a group of related values and enables you to work with those values in a type-safe way within your code. Or when a property can have its value only out of a defined set, enum is the solution which complimentary provides type-safety and auto-completion at compile time.
Enumerations can define initializers to provide an initial case value; can be extended to expand their functionality beyond their original implementation; can have functions and can conform to protocols to provide standard functionality.
Enums can have nested enums and associated values.
Enums can be recursive: A recursive enumeration is an enumeration that has another instance of the enumeration as the associated value for one or more of the enumeration cases. “Indirect” keyword is used to inform the compiler about recursion.
Each enum case’s rawValue depends upon the raw type taken and if no raw type is not taken than rawValue wouldn’t be available. Swift’s enums don’t bound to use only integer type as a raw type, you can use Strings, Characters or even Floats instead.
Properties of a constant instance of the struct are immutable because struct’s instance own the whole object and by declaring it as a constant means the whole object itself will be immutable.
Properties of a constant instance of the class are mutable as class’s instance owns the object’s reference thus by declaring it as a constant only means that the further reference assignment can’t be done.
Structs are blessed with default member-wise initializer but classes are not.
Structs are preferable when they are small and copyable.
With Structs, there is much less need to worry about memory leaks or multiple threads racing to access/modify a single instance of a variable.
Since struct instances are allocated on the stack, and class instances are allocated on the heap, structs can sometimes be drastically faster (but it still depends on how many values you’re storing and the size/structure.)
In a multi-threaded environment, for instance, with a database connection that’s opened in a different thread, structs are safer. They can be copied from one thread to another thread, without running the risk of a race condition or deadlock. Classes do not have this inherent safety unless they’re deliberately made thread-safe.