<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Keenan Warouw on Medium]]></title>
        <description><![CDATA[Stories by Keenan Warouw on Medium]]></description>
        <link>https://medium.com/@keenanwarouw?source=rss-7b7b224d29c5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*iuMDH6LRd2Ym1WYi.jpg</url>
            <title>Stories by Keenan Warouw on Medium</title>
            <link>https://medium.com/@keenanwarouw?source=rss-7b7b224d29c5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:01:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@keenanwarouw/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Top iOS Fundamental Interview Questions and Answers]]></title>
            <link>https://medium.com/dana-engineering/top-ios-fundamental-interview-questions-and-answers-12f0326d533?source=rss-7b7b224d29c5------2</link>
            <guid isPermaLink="false">https://medium.com/p/12f0326d533</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Keenan Warouw]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 02:32:25 GMT</pubDate>
            <atom:updated>2022-06-07T08:28:03.774Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dTbM8m1PhV1zySOp" /></figure><p>According to <a href="https://backlinko.com/iphone-users">Backlinko</a>, an estimated 1 billion people uses iPhone worldwide. With the addition of Apple TV and Apple Watch users, the market keeps on expanding, and iOS software engineers are in high demand.</p><p>The talent shortage keeps pushing salaries higher and higher, even for entry-level positions. Software development is also one of the few fortunate jobs that you can do remotely. It’s understandable then that more and more people are interested to become an iOS developer.</p><p>In this article, I will include common interview questions, how often they would come up, and how I personally would answer these questions.</p><p>I will rank the rarity by how often the questions come up during my interviews :<br><strong>Rare </strong>(1–3 times out of 10)<br><strong>Uncommon </strong>(4–6 times out of 10)<br><strong>Common</strong> ( 7–9 times out of 10)<br><strong>Every Time! </strong>(10 times out of 10)</p><p>After reading this article, hopefully, you can land that iOS Developer job that you wanted. I will also include a way to greatly boost your chance of succeeding in your interview at the end of this article 😉</p><h3>Basic Object-Oriented Programming</h3><h4>1. What is the relation between class and object?</h4><ul><li>Class is a template of an object, which defines properties and behaviors. And an object is an instance of a class. ex:</li><li>Class MainViewController: UIViewController {} ← Class Declaration</li><li>let vc: UIViewController = UIViewController() ← Object Definition</li></ul><p><strong>Rarity</strong>: <em>Uncommon</em><br><strong>Notes: </strong>While this question doesn’t appear as frequent, it will give a bad impression if you can’t answer this question as it is a very basic question.</p><h4>2. Please explain the 4 Pillars of OOP</h4><ul><li><strong>Abstraction</strong>.<br>Abstraction is an OOP concept by which we expose relevant data and methods of an object while hiding their internal implementation.</li><li><strong>Encapsulation</strong>.<br>Encapsulation is a concept by which we hide data and methods from outside intervention and usage.</li><li><strong>Inheritance</strong>.<br>Inheritance is defined as a process by which a child class inherits the properties of the parent class.</li><li><strong>Polymorphism</strong>.<br>Objects of the same class can behave independently within the same interface.</li></ul><p>read more about the 4 pillars in detail here: <a href="https://medium.com/swift-india/oops-in-swift-998738407423">https://medium.com/swift-india/oops-in-swift-998738407423</a></p><p><strong>Rarity</strong>: <em>Rare</em><br><strong>Notes: </strong>For mid-senior level positions, this question doesn’t come out as often as it is a question designed for entry-level positions and people with less experience with iOS Development. However, the 4 pillars expand to any Software Development role and not just iOS.</p><h4>3. Please explain the difference between Struct and Class</h4><ul><li>Struct is a value type while Class is a reference type.</li><li>A reference type passes an object by its memory address while a value type passes the value.</li><li>Classes can also be inherited while Structs cannot. Both can conform to protocols in Swift.</li></ul><p><strong>Rarity</strong>: <em>Every time!</em><br><strong>Notes: </strong>This question came out in every single interview I’ve had regardless of the seniority level. A must-know for iOS Developers.</p><h4><strong>4. Overriding Method vs Overloading Method</strong></h4><ul><li>Method overloading is the process by which a class has two or more methods with the same name but different parameters.</li><li>Overriding is the process by which two methods have the same method name and parameters. One of the methods is in the parent class and the other is in the child class. An example is how we override viewDidLoad() method in our ViewController class.</li></ul><p><strong>Rarity</strong>: <em>Rare</em><br><strong>Notes: </strong>Same as the 4 pillars, a fundamental question that expands to more than iOS Development role.</p><h3>Design Patterns</h3><h4>1. Please explain the MVC(Model-View-Controller) pattern, what are its pros and cons?</h4><ul><li><strong>M- Model</strong>, the Model Layer in MVC should hold and represent your application data.</li><li><strong>V- View</strong>, the View Layer in MVC should handle your application’s interface logic and controls the objects that your users can interact with. Basically, all the UIView derived objects.</li><li><strong>C- Controller</strong>, the Controller layer in MVC is the mediator between the View and the Model. It accesses the Data in the Model and will adjust the View accordingly.</li><li><strong>Pros</strong>- MVC is the most common and used design pattern in the iOS environment. It is easy to learn, people can adapt to it easily, and most iOS developers are familiar with it.</li><li><strong>Cons</strong>- The Controller holds too much responsibility in this pattern. There are jokes within the community that MVC stands for Massive-View-Controllers because of how convoluted the Controller classes are in this pattern.</li></ul><p><strong>Rarity</strong>: <em>Every time!</em><br><strong>Notes: </strong>You absolutely have to know what MVC is since it’s essential to any iOS development. There are other common architectures like MVVM, VIPER, and MVP that you can explore, but MVC will be the one on the top of the list for iOS Development. If you are asked about a Design Pattern that you have no prior experience of, it’s better to say so rather than trying to explain something that you read from the internet but have no experience of.</p><h4>2. Explain the Singleton pattern. What are its pros and cons?</h4><ul><li>The Singleton design pattern ensures that only a single instance exists for a given class and that there’s a global access point to that instance. An example would be when you use instances like UserDefaults.standard or DispatchQueue.main</li><li><strong>Pros</strong>- It can be accessed everywhere, therefore easy to access no matter the class you are trying to use it from.</li><li><strong>Cons</strong>- Since it can be accessed everywhere, it can easily be abused by the developers and it might be hard to trace where the data are being manipulated if it is being modified in too many places.</li></ul><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>One of the most used patterns and the one most prone to being misused. How you explain this pattern will determine your seniority level.</p><h4>3. Explain the Observer pattern. What are its pros and cons?</h4><ul><li>In the Observer design pattern, an observed object called the Observable will broadcast all its changes to any objects that observe it(Observers). An example of an Observer pattern in iOS would be the NotificationCenter.</li><li><strong>Pros</strong>- Very handy to use since you can run a method when you detect changes.</li><li><strong>Cons</strong>- Might find it hard to track the flow if there are too many observers observing the same observable.</li></ul><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>There are more design patterns in iOS, like Facade, Adapter, Decorator, etc. The Singleton and Observer are the most frequently asked ones in my experience. Again, if you are asked about a Design Pattern that you have no prior experience of, it’s better to say so rather than trying to explain something that you read from the internet but have no experience of.</p><h3>Views and Interface Builder</h3><h4><strong>1. What is the difference between frames and bounds?</strong></h4><ul><li>The view’s frame is its location and size according to its parent’s coordinate system</li><li>A view’s bounds are its location and size according to its own coordinate system</li><li>Example you create a view at x:0 y: 0, with width: 50 height:50. When you move the view’s coordinate, the view’s frame will reflect the change but its bounds will not.</li><li>The same thing will happen when you try to rotate the view. The view’s frame will reflect the change, while the bounds will not. Because internally in the view, it hasn’t changed</li><li>example code:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pGgQmeHzT8sc_BqfYlt4-g.png" /></figure><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>Another frequently asked question. You can easily get them mixed up between each other so be sure to try them out beforehand!</p><h4>2. Name the inheritance tree of a UIButton</h4><p>NSObject — UIResponder — UIView — UIControl — UIButton</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/0*oDcZGbtilj8jJKAZ.png" /><figcaption>credit: <a href="https://stackoverflow.com/questions/3323209/class-hierarchy-of-nsobject">https://stackoverflow.com/questions/3323209/class-hierarchy-of-nsobject</a></figcaption></figure><p><strong>Rarity</strong>: <em>Rare</em><br><strong>Notes: </strong>Although specifically asking the inheritance tree of a UIButton is rare, interviewers like to ask about classes and the behaviors that it inherits from the parent.</p><h4>3. Explain how you will create this interface in your app</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*54FMwLVbU-BVcnHy90OdkA.png" /></figure><p>There are many ways to create this, using storyboard, programmatically, xibs, etc. Just explain your most comfortable way of creating. Explain how you can place everything in the middle of the screen, probably by using the superview’s center, width, and height. Explain how you can place the writing relative to the image, and how the bottom label’s placement is relative to its top label. Don’t forget to mention autolayout if you are using it.</p><p><strong>Rarity</strong>: <em>Uncommon</em><br><strong>Notes: </strong>Keep in mind that this is a sample image. The interviewer can come up with any kind of layouts they want and will try to understand your problem-solving skills on how to create a specific layout.</p><h4>4. What is the difference between UICollectionView and UITableView? When to use which?</h4><ul><li>UICollectionView enables you to scroll horizontally and vertically. While UITableView only allows vertical scrolling</li><li>UICollectionView has UICollectionViewDelegateFlowLayout which provides you the ability to control the flow</li><li>UICollectionView allows the user to dynamically change the size and shapes of each cell</li><li>UICollectionView also supports custom animations in different types of layouts</li></ul><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>One of the most instrumental tools in creating a layout in iOS. Interviewers will be looking at your experience with each tool.</p><h3>Application Lifecycle</h3><p>This <a href="https://hackernoon.com/application-life-cycle-in-ios-12b6ba6af78b">article by <strong>@</strong>pleelaprasad</a><strong> </strong>brilliantly explained the iOS Application Lifecycle. I will try to summarize it for interview questions here</p><h4>1. What are the iOS Application states? Briefly explain them.</h4><ul><li><strong>Not Running/Terminated- </strong>The state when the application has not started or has been terminated</li><li><strong>Inactive- </strong>The state when the application is running in the foreground, but is not receiving any events. The most common way to achieve this state is when you receive a call when using the app. This state could also be achieved during the transition between other states. App UI cannot be interacted while in this state</li><li><strong>Active- </strong>The normal state for a foreground app. The app is running in the foreground and is receiving events. This is the state when the user is using the app and is interacting with the app.</li><li><strong>Background- </strong>The application is running in the background and can still execute codes. When you minimize the app, it transitions to this state briefly, usually about 5 seconds, before transitioning to the suspended state.</li><li><strong>Suspended- </strong>The application is in the background and is not executing any codes. This state is achieved automatically by the system and does not notify. When the system detects low memory on the device, it may purge applications that are in the suspended state without notifying them.</li></ul><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>Although perfectly answering all states are good, missing a few things make you human. Certain states are used more frequently than other and certain apps might not even touch a specific state. Answer according to your experience.</p><h4>2. What happens when the user swipes up or presses the home button to minimize the app?</h4><p>The application that is in the foreground will transition from <strong>Active </strong>state to <strong>Inactive</strong> state briefly. The app will then be in a <strong>Background</strong> state and process any final event it needs to. After a few seconds, the app will be put in the <strong>Suspended</strong> state. If the system needs more memory for the current foreground app, the suspended app may be <strong>Terminated</strong></p><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>Not much to say about this. A frequently asked question and a pretty straightforward answer</p><h3>Memory Management</h3><h4>1. How is memory management handled on iOS?</h4><p>In Swift, there is something called <strong>ARC</strong>(Automatic Reference Counting) that tracks and manages memory usage. It is similar to Garbage Collector in Java if you have experience with it. ARC automatically frees up the memory used by class instances when those instances are no longer needed.</p><p><strong>Rarity</strong>: <em>Every time!</em><br><strong>Notes: </strong>Another must know! Memory management is very important in any application, especially in iOS apps that have memory and other hardware and system constraints. Memory leaks and app crashes are all too common due to poorly managed memory in iOS apps.</p><h4>2. What is a strong and weak reference?</h4><ul><li><strong>Strong- </strong>when you declare a strong reference to an object, you are telling ARC not to deallocate the object when there are still references to the object. This also increases the retain count by 1</li><li><strong>Weak-</strong> A weak reference is a reference that doesn’t keep a strong hold on the instance it refers to, and so doesn’t stop ARC from disposing of the referenced instance. ARC will change a weak reference to nil when it is being deallocated. Because of that, a weak reference cannot be a constant(let) and must be a variable(var)</li></ul><p><strong>Rarity</strong>: <em>Every time!</em><br><strong>Notes: </strong>As mentioned before, memory management is very important in iOS Development so this question will come naturally as a follow-up question from before. In Objective-C, in addition to <strong>weak</strong> and <strong>strong</strong>, there’re also types like <strong>assign</strong> and <strong>retain.</strong></p><h4>3. What is a retain cycle and how do you solve it?</h4><ul><li>A retain cycle happens when at least 2 objects hold a strong reference to each other. Therefore preventing ARC to deallocate the object, preventing the retain count to be 0, and preventing the memory to be freed.</li><li>To solve it, you need to decrease the retain count to 0. One way to do this is by making the strong references to be a weak reference.</li></ul><p><strong>Rarity</strong>: <em>Every time!</em><br><strong>Notes: </strong>There are other approaches on how to solve a retain cycle and that is a field that you can deep dive to learn on. Making a strong reference into weak is just the most common alternative</p><h3>Thread Management</h3><h4>1. What are the different threads in iOS?</h4><p>From high to low priority with an explanation on when to use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d4uz3ldYviwfGlm0RUC3aw.png" /><figcaption><a href="https://developer.apple.com/documentation/dispatch/dispatchqos">https://developer.apple.com/documentation/dispatch/dispatchqos</a></figcaption></figure><p><strong>Rarity</strong>: <em>Uncommon</em><br><strong>Notes: </strong>Although it’s not common that interviewers ask you to name all of the QoS, it is essential to know that there are different threads in iOS and at the very least you should be able to name the <strong>main thread</strong> and the <strong>background thread</strong>.</p><h4>2. What is a Serial and Concurrent queue?</h4><p>From A<a href="https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html">pple developer docs</a>:</p><ul><li><strong>Serial queues</strong> (also known as <em>private dispatch queues</em>) execute one task at a time in the order in which they are added to the queue. The currently executing task runs on a distinct thread (which can vary from task to task) that is managed by the dispatch queue. Serial queues are often used to synchronize access to a specific resource.</li><li><strong>Concurrent</strong> queues (also known as a type of <em>global dispatch queue</em>) execute one or more tasks concurrently, but tasks are still started in the order in which they were added to the queue. The currently executing tasks run on distinct threads that are managed by the dispatch queue. The exact number of tasks executing at any given point is variable and depends on system conditions.</li></ul><p><strong>Rarity</strong>: <em>Uncommon</em><br><strong>Notes: </strong>This question can be word differently, or asked in a different way. They can ask about <strong>synchronous</strong> and <strong>asynchronous</strong> tasks instead.</p><h4>3. What is a Race Condition?</h4><p>A race condition occurs when two or more tasks are executed concurrently when they should be executed sequentially in order. You can’t change the view constraint while it is being calculated. So UI activity should be done in the <strong>main thread</strong> so it is executed sequentially.</p><p><strong>Rarity</strong>: <em>Rare</em><br><strong>Notes: </strong>While not being a commonly asked question, this question can boost the impression of your interviewers if you can answer it with experience.</p><h3>Storage</h3><h4>1. What are the persistence data options available in iOS and when to use which?</h4><ul><li><strong>UserDefaults</strong>- UserDefaults is easy to use. It can be accessed throughout the app, it can collide keys though as it uses the keys to store values. Data inside UserDefaults is not encrypted.</li><li><strong>CoreData</strong>- CoreData enables you to save customized Data objects. Not very simple to use and needs to learn before fully mastering it. Need to also look out for the thread-safety.</li><li><strong>FileManager</strong>- FileManager saves data using URL paths. It can be used with iCloud, it can also save large objects like photos. URL paths can be error-prone. The reading/saving process can be slow.</li><li><strong>Keychain</strong>- The main advantage of using Keychain is that the data are encrypted for security. Although speed can be slower and is not recommended for large objects. Useful for saving sensitive data like emails, phone numbers, etc.</li><li><strong>plist</strong>- plist is easy to use, it stores some app values. It can only store small objects or data types though.</li></ul><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>Most of the time, they won’t expect you to name all the options, just the one you have experience with. Or they can specifically ask how <strong>UserDefaults</strong> or <strong>Keychain </strong>work and not give a care to the rest. Knowing about <strong>UserDefaults</strong> is essential though as it is the most common persistence data used in iOS.</p><h3>Other Common Questions</h3><h4>1. Why do we use dequeueReusableCellWithIdentifier in table views and collection views?</h4><p>By using dequeueReusableCell, we only create the cells needed to fill the screen and a little more. As the user scrolls, this method will dequeue the cells that are no longer on the screen and reuse them for new cells. Leading to a much more memory-efficient task.</p><p><strong>Rarity</strong>: <em>Uncommon</em><br><strong>Notes: </strong>99% of the time, if you have created a TableView or CollectionView before, you have used the function dequeueReusableCellWithIdentifier. It will leave a positive impression for the interviewers if you can explain the tools that you have used and not only copying online sources.</p><h4>2. What is Reactive Programming?</h4><p>Reactive Programming focuses on asynchronous data streams, which you can listen to and react accordingly. In simple form, <strong>reactive programming</strong> enables you to subscribe and react to changes within an object, rather than requiring you to re-check object states and manually adding conditions</p><p><strong>Rarity</strong>: <em>Common</em><br><strong>Notes: </strong>For a large-scale project, Reactive Programming is extremely useful. If you’re joining an established team of developers with a large-scale product, they will ask this question most of the time.</p><h3>Practice Questions</h3><p>Below are practice questions for you that I have used to interview people and have received during interviews.</p><ol><li><strong>How do you debug memory leaks? </strong>(zombie, memory debugger, etc)</li><li><strong>What do you use to integrate dependencies into your project? </strong>(Cocoapods, Carthage, SPM, etc)</li><li><strong>How do you test your project? </strong>(Unit Test and UI Tests, what framework you use)</li><li><strong>How do you run a background fetch?</strong> (how you update the app while it is not active to reduce the amount of updates that needed to be downloaded when the user opens the app)</li><li><strong>How do you handle push notifications?</strong></li><li><strong>What is the difference between static and dynamic library?</strong></li><li><strong>What are the View Lifecycle processes and what do they do? </strong>(viewDidLoad, viewDidAppear, viewDidDisappear, etc.)</li></ol><h3>Conclusion and What’s Next</h3><p>Thank you for reading this article. Again, this article compiles the question that I have received and used for interviews. You might have a completely different experience during interviews and receive different questions compared to mine. I would be happy to hear your interview stories in the comments!</p><p>Hopefully, after reading this article, you can word your interview answers better and understand the things that you have been using, but could not quite find the right words to describe them.</p><p>The best way to succeed in the job interview that you are aiming for from my experience is by trying out a few interviews beforehand. I read an article suggesting people try interviews every 2 years even if you are content with your current workplace. Not only does an interview helps you present yourself, helps you get updated with the current trend, review the things you have done, it also enables you to know the current situation and demand in your industry.</p><p>Every time you fail an interview, you can note the questions that you fail to answer, learn about them afterward, and answer them on the next interview. So it is a good practice to ask a friend to do a mock interview with you, or do a real interview for practice and get better each time. For me, it is a challenging and rewarding experience. You don’t have to accept the job offer if you don’t feel like it.</p><p>Thank you for reading my article! Big kudos to my mentors, mas <a href="https://www.linkedin.com/in/yoga-widyakrisna-10a7a7119/">Yoga</a> and mas <a href="https://www.linkedin.com/in/heru-surya-pratama-1ab874a1/">Heru</a> for their feedbacks and for helping me polish this article. If you have any questions or have anything to add, feel free to comment them below or reach out to me at L<a href="https://www.linkedin.com/in/keenan-warouw/">inkedin</a>. Any inputs or feedbacks are welcome!</p><p>Sources:<br><a href="https://backlinko.com/iphone-users">https://backlinko.com/iphone-users</a></p><ul><li><a href="https://medium.com/swift-india/oops-in-swift-998738407423">OOPs in SWIFT</a></li><li><a href="https://www.raywenderlich.com/477-design-patterns-on-ios-using-swift-part-1-2#toc-anchor-002">Design Patterns on iOS using Swift - Part 1/2</a></li><li><a href="https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html">Automatic Reference Counting - The Swift Programming Language (Swift 5.7)</a></li><li><a href="https://hackernoon.com/application-life-cycle-in-ios-12b6ba6af78b">The iOS Application Lifecycle | Hacker Noon</a></li><li><a href="https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html">Dispatch Queues</a></li><li><a href="https://www.hackingwithswift.com/example-code/uikit/whats-the-difference-between-frame-and-bounds">What&#39;s the difference between frame and bounds?</a></li><li><a href="https://doordash.engineering/2019/05/22/ios-memory-leaks-and-retain-cycle-detection-using-xcodes-memory-graph-debugger/">How to detect iOS memory leaks and retain cycles using Xcode&#39;s memory graph debugger - DoorDash Engineering Blog</a></li></ul><p><a href="https://iosinterviewguide.com/ios-interview-questions-for-senior-developers-in-2020">https://iosinterviewguide.com/ios-interview-questions-for-senior-developers-in-2020</a></p><p><a href="https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html">https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12f0326d533" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dana-engineering/top-ios-fundamental-interview-questions-and-answers-12f0326d533">Top iOS Fundamental Interview Questions and Answers</a> was originally published in <a href="https://medium.com/dana-engineering">DANA Product &amp; Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From App Developer to SDK Developer(iOS)]]></title>
            <link>https://medium.com/dana-engineering/from-app-developer-to-sdk-developer-ios-f3b8fcf232f3?source=rss-7b7b224d29c5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3b8fcf232f3</guid>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[objective-c]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Keenan Warouw]]></dc:creator>
            <pubDate>Wed, 03 Jun 2020 13:21:46 GMT</pubDate>
            <atom:updated>2020-06-24T04:13:11.474Z</atom:updated>
            <content:encoded><![CDATA[<h3>From App Developer to SDK Developer (iOS)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fhktnQkAW37zOVjXNU-rMw.jpeg" /></figure><h3>Background</h3><p>I got the opportunity to share about my experience when transitioning from an App Developer to SDK Developer in DANA Indonesia in one of the recent DANA’s GeekTalk: “Effective iOS Development: What Tools Do You Need?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFrU3rmehhcL6aPV8-vKgg.jpeg" /></figure><p>Sucks for me, even after the multiple practices that I did before presenting, I was still nervous during the presentation.<br>Which kinda resulted in me speaking too fast and missing some important points 😔.</p><p>Luckily, we have this Engineering Blog, where I can kinda fix my mistakes and explain myself better than what I did during the presentation.</p><p>So, cheers to this second chance and hope I don’t miss anything else before publishing this. ✨</p><h3>DANA SDK</h3><p>As you all know, DANA has its standalone app called DANA (duh!) which you can get from the App Store or Play Store. But other than our app, we also have our custom-made SDK that we share with our clients so that they can use our features easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iqgj2XgzEmOY5wR2b7X3WA.png" /></figure><p>Why would our clients use our SDK? What do we provide for them?</p><p>Glad you asked, here are some of our SDK use cases that we provide to our clients:</p><ul><li>A <strong>Payment Method</strong>, either with DANA Balance, Debit card, or Credit Card</li><li><strong>User Binding</strong> with DANA</li><li><strong>QR Decoder</strong>, using a camera or decoding a string</li><li><strong>QR Generator</strong> can generate a QR Image or QR String</li><li>Opening an <strong>interactive in-app browser</strong></li><li>And so on..</li></ul><p>Pretty neat right? Our clients can make a mini-app by themselves just by using our SDK.</p><p>“But why should we use SDK instead of doing a direct back-end call? That way we don’t have to integrate with your SDK”</p><p>Well, you can indeed do a direct back-end Http request and process the response by yourself, but why would you? Here’s a difference between using our SDK and doing an API Call Manually with generating a QRIS (Quick Response Code Indonesian Standard) string as an example :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GfnEf_8nhPh_xYVQRcfkIQ.png" /></figure><p>In this example, I simplified a few processes like “Get required QRIS data from response” into a single process for transparency purposes, even though it has a few more steps included in it.</p><p>As you can see, our SDK handled quite a few numbers of actions that our clients should’ve done into a much simpler, precise, and definite action. So, again, it is up to you which one you want to use, but I’d recommend doing the API call if you want more works laid out for you 😉.</p><h3>Starting Out</h3><h4>I have never developed an SDK before. There’s no interface, how do I see the outputs?</h4><p>If you started as an App Developer and transitions to an SDK Developer, this might be your initial concern. Compared to apps where we can see the Interface and UI.</p><p>Our SDK products are in the form of frameworks. We can’t run frameworks. So how do we test it?</p><p>There are 2 ways to test them, and I recommend doing both of them.</p><h4>The first way is to create an Example App that uses your framework.</h4><p>So, starting from the beginning let’s create a new project. We won’t be making a single view app though, we will make a framework like in the following picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*KV_XgWaWOggADrZnUjjWBw.png" /></figure><p>I named my framework <strong>PronouncerService</strong>, to do some pronouncing stuff. You can do it in Swift, but for this example, I’ll be doing it in Objective-C</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/124/1*1Y5xbJYEG8bn_io8SldB5A.png" /></figure><p>Go to the project directory, you should see that the target is in the form of a framework. Add a new target, scroll down, and select single view app as the target. and name it however you want, but make it descriptive. I name mine <strong>PronouncerServiceExample</strong> because it is an example project of my <strong>PronouncerService</strong> framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuFjhBx8fucnudTS7m7Wrg.png" /></figure><p>I created a new class called <strong>NumberCheckerService</strong>, and inside it, I have this super awesome function in my framework that can tell if a number is one or not 😏.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*akAQBtpzZvvNKre34X06UQ.png" /></figure><p>You need to make sure the class is set to public in <strong>Build Phases → Headers.</strong> So people can use it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eeKPrHUJt934-_wNd2xEHg.png" /></figure><p>Don’t forget to also import the framework on the Example Target</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZ5Cjx-GAN_Y_4SZP4vemw.png" /></figure><p>Now head on to your ViewController, import your framework and delegate. Create a simple UI and test to see if the code that your framework has is working properly by using the functions that your framework provides.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLDS1kCJHrV4_yXZmfKm7A.png" /></figure><p>Congratulations! You have successfully made an SDK and tested it in the shoes of your clients!</p><h4>The other way is to use unit test</h4><p>If you’ve experienced doing unit tests already, it should prove easy for you. Basically, we will test all our functions and see if they work as intended using pure codes.</p><p>Unfortunately, I can’t provide you the step to step on how to unit test your SDK in this article. But if you are interested in it, drop a comment and I can try making it in future articles.</p><h3>Lessons from being an SDK Developer</h3><p>Here in DANA, we have 3 principles that we uphold in our day to day work as well as in the products that we deliver. And I think these 3 principles fit in quite well with the principals that we should implement in our SDK. The Principles are:</p><ul><li><strong>Trusted</strong></li><li><strong>Friendly</strong></li><li><strong>Accessible</strong></li></ul><h3>Trusted</h3><p>Trusted implies that we deliver what we are expected to deliver. Our customers trust us to deliver a quality product, and that is what we are going to deliver to them.</p><p>That means our code must have <strong>no crashes</strong>, <strong>no bugs</strong>, and <strong>no unexpected behaviors.</strong></p><p>How do we achieve that?</p><p>In DANA, we have what we call <strong>CI 991 </strong>for our CI process. Part of CI 991 is implementing <strong>991 Test Criteria</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*3ZusoIXjDqK1jY9vXrUNhw.png" /></figure><p>The first 9 indicates a 90% build pass, which means that when we run 10 unit tests, it must succeed 9 times before it becomes acceptable.<br>The second 9 indicates 90% Code Coverage, which means that in the whole project, it must reach 90% Code Coverage.<br>The last 1 indicates that the whole unit test must be completed in less than 10 minutes of build time.</p><p>In Xcode, you can achieve this by running Unit Test (Cmd + U), switch to the Report navigator from the Project navigator, and see the code coverage and Log for these pieces of information. As shown in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*00-CfCzdPZj9IedDZJ2mYQ.png" /></figure><p>The 991 Test Criteria, Example Project (explained in the previous segment), Code Review, and QA check will help ensure that our SDK is well tested before delivering it to our merchants.</p><p>In addition, to make sure that there are no unexpected behaviors in our code, we must make sure that we will catch any exception in our methods. This is also tested using Unit Test.<br>First, enable code coverage by clicking the top right part in your Xcode, and click on Code Coverage to enable it as seen in the example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*w-TJKQCb3lIY5F2R8wb82Q.png" /></figure><p>If your code is not tested yet, it will be shown in red like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/122/1*-UP8xS7qQj2tW-Y9RcM0aw.png" /></figure><p>But if your code is fully tested, and all exceptions are covered, it should show something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o6VZ8d7oapthEO8wzK_dug.png" /></figure><p>Lastly, the merchants will lose their trust if they find any issues with your SDK, so make sure that your code is well tested before distributing them!</p><h3>Friendly</h3><p>To make our SDK user friendly, our users must feel comfortable using it. There are 3 points that I think would improve the friendliness of our SDK, they are:</p><ul><li><strong>Language</strong></li><li><strong>Design Pattern</strong></li><li><strong>Code Implication</strong></li></ul><h4>Language</h4><p>Let’s start with language, as an iOS Developer, we only have 2 choices of language, <strong>Swift</strong> and <strong>Objective-C</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*UGenhD2r9B5YeOB4HU6SGg.png" /></figure><p>If you’re in a rush, I would say go with your preferred language. But if it’s a long term project and you’re just starting out, you might want to think carefully before you decide your language of choice.<br>In DANA, we use objective-C to create our SDK because we’ve been creating our SDK before Swift was proven stable for backward compatibility.</p><p>Now, since Swift is officially ABI stable, you have the option of writing your SDK in the newest version of Swift without having to worry about your clients receiving errors for using a different version of Swift. There is a whole lot of arguments and debates out there regarding Swift vs Objective-C, so you might want to research them first before finally deciding your choice. Just put yourself in your customer’s seat and imagine which SDK would be friendlier to them, Swift or Objective-C?</p><h4>Design Pattern</h4><p>As an iOS SDK, for iOS Developers, we should use a Design Pattern that’s common and well-known in the iOS Environment. We can use things like the Singleton Pattern, Delegate Pattern, or anything as long as it’s familiar and will not trouble our clients</p><h4>Code Implication</h4><p>What does your code imply it will do?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0pkW17BQKlvnfFdYqJXkNw.png" /></figure><p>Take a look at this function. This function implies that it will convert your value in the form of NSNumber, and return a Hex form of that value in the form of NSString. It explains everything that it will do from the name and parameters.</p><p>A code with good implication is self-explanatory and does not require our user to spend time thinking about what it does. If it says that it will convert to a Hex value, it should do just that. There shouldn’t be any processing user data in the function, there shouldn’t be any networking done in it if it doesn’t explicitly says so. It should only <strong>do what it implies to do</strong>.</p><h3>Accessible</h3><p>Finally, our SDK should be accessible. That means our SDK should <strong>easily be understood and used. </strong>Remember, our clients want to use our SDK because they want to save time. They want us to do the work for them. If our SDK is not accessible, why would they want to use it? Since it’s going to take a lot of work anyway.</p><p>To make our SDK accessible, we can give our code some documentation when they are needed. Ideally, our code should be able to explain itself, but if that’s not possible, we can always give some comments so our clients can better understand them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LL50F_irtaRg31bYqmx_WA.png" /></figure><p>Be careful about documentations though, not all codes need documenting, as some codes should be able to explain themselves. Be careful not to put unnecessary comments as it will create a lot of distracting noise like in this example below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*i5KZ8ENL5K1dk8IBNNjQig.png" /></figure><p>We should also include documentation on our repository page. As that is what our customers first see before reading our code. Documentations in our Repository should be in the form of <strong>README </strong>and also a <strong>changelog</strong></p><p>READMEs are a way to explain our SDK they should include the necessary steps from how to install them, until how to implement them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*0fqkuWRITAr8q-WLOkPpKQ.png" /></figure><p>While changelogs are used to describe the changes from the previous version to the newest version. So that our users will know what to change when they update to the newest version. Here’s an example of RxSwift’s changelog:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*mRd2-bPrI7Y4TdMrb5G28A.png" /></figure><h3>Accessing our SDK</h3><p>Should you or your business be interested to integrate DANA’s SDK into your app, please reach out to DANA’s business team and we will provide the best solution for you.</p><h3>Conclusion</h3><p>In conclusion, our SDK should be a <strong>Trusted, Friendly, </strong>and <strong>Accessible </strong>for all our customers</p><p>And with that, you should learn all the necessary skills to become an SDK Developer! I hope this article can be a help to all you readers. Head over <a href="https://dana.id/karir">here</a> should you want to join our amazing team in DANA!</p><p>Special thanks to my mentor, mas <a href="https://www.linkedin.com/in/hardianprakasa/">Hardian Prakasa</a> who helped me with this article, without whom i wouldn’t have thought of this topic nor write this article 🙏</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3b8fcf232f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dana-engineering/from-app-developer-to-sdk-developer-ios-f3b8fcf232f3">From App Developer to SDK Developer(iOS)</a> was originally published in <a href="https://medium.com/dana-engineering">DANA Product &amp; Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>