
SDE II
Myglamm, Good Glamm GroupSoftware Engineer - iOS
Boppo Technologies Pvt LtdAssistant Professor
Dnyanasadhana CollegeBest Performer of the quarter
Fine. Will you help me understand more about your background by brief Introduction of yourself. Okay. Um, so, yeah, I have worked as a as developer for 5 plus years of experience. I have, like, I have worked upon, like, ARKit, and I have developed applications, uh, 6 applications to be precise. And I've been, like, uh, responsible for, like, uh, developing and, like, deploying the application to the App Store. Um, I have, like, done most challenging stuffs, uh, like, integration of CICD and, uh, like, uh, creating multiple schema application u using single code base. I have created a private repository using private CocoaPod. I've, like, uh, worked with ARKit to create a virtual experience.
Uh, what approach would you take to handle asynchronous task in Swift? So asynchronous task is basically used to, like, uh, deploy anything to the background thread. There is something called GCD, Grant Central Dispatch Queue. Uh, so we can use basically, uh, DispatchQueue dot global and then, like, set the priority which we want to set anything to the background thread. Or if you want to, like, update some UI stuff, we can use like batchq.main.async. Um, but when we use, like, asynchronous thread, we should be, like, aware about the closure which can capture shall
Can you describe the scenario where you will use code data for persistent storage instead of user default? So code data is basically, like, a table or form format. So Uh, example, if you want to save the offline storage, like, uh, we have a ecommerce website, uh, application, and we want to store, uh, the products or, like, some search queries, uh, whatever the user has been, like, done. And it's a big amount of data. So we will basically store it in a core data instead of, uh, user default because user default are generally useful for storing small chunk of data which is not user sensitive. So in code data, we can store large form of data like, uh, user search query, like recent histories or something in that way.
An app requires a new feature for secure financial transaction. How will you design and implement this feature while ensuring high security? NAP requires a new feature for secure financial transaction. How will you design and implement this feature while ensuring the high security? So first, I will look into it. Like, uh, my question would be, like, are we developing it from the scratch, or we are integrating, like, a third party library like Razorpay. If we are integrating third party library like Razorpay, most of the implementation part of security is being done from their side. But but if we are doing, like, security handling the security like, development and security part in our side. We will first check. Our HTTP request is, uh, basically, secure. Then, like, developing the modules, we will basically, like, create a clean architecture. You create the repository user use case and, like, Inject those like dependencies in the ViewModel. And this will be basic architecture for the application. And, uh, we can, like, segregate this financial transaction module, uh, differently. So whenever the UI, like, UI changes So something happened. It is not directly dependent to the UI. And for, like, security purpose, uh, we can, like, Have the binary vulnerability checked using the security departments and, like, try to minimize Sharing important security stuff. Like, uh, for example, the user token Or, like, user authentication password should be stored in, like, somewhere secured in keychain instead of storing it, uh, like, normally.
Uh, how do you ensure thread safety when reading and writing data to a shared resource in multithreaded environment? You ensure threat safety when reading and writing data to a shared resource in a multi threaded iOS app. Um, so, basically, uh, we, uh, multi threaded multithreads we use, uh, like, we have closures. We will, basically, make it a weak self, so we don't capture the, uh, object over there. And, uh, we have to look into it. Like, Oh, for example, 1 thread is reading and 1 thread is writing. So, we have to use dispatch barriers. A dispatch barrier basically can prevent 1 third from updating, uh, uh, 1 third from accessing when other thread is updating. So we can use dispatch barrier whenever Uh, Update Process is on so that the process goes in a synchronous manner and there is no deadlock situation over there and the app doesn't crash.
Describe how you decide when to use a storyboard versus including a interface in code or for an iOS app. So, uh, whenever, like, uh, Storyboard and versus a interface code. So it's a highly debatable question. It depends upon who likes what. Um, so when you have a storyboard, it is quite easy to, like, Uh, look into the UI and get to know what stuff we have. Like, uh, it creates a NIP file. And NIP file, we can See, like, whatever the user interface over there. But in code, you have to go line by line and check what the thing are there. But with code, we get the modularity control. Like, if we want to reuse the view in multiple locations, if we want to have high customizability. We can achieve it using a code. Uh, but with Storyboard, it is quite hard to, like, reuse or Uh, reuse that view like we have to create a separate new file and then the include that class And it's a quite a lengthy process using Storyboard. So for usability purpose, we can use code, which is quite easier to, like, reuse.
Slow code snippet that meant to load images asynchronously in iOS application. There seems to be an issue with memory management. Can you spot it and suggest a solution? Okay. So this is a method for Image Loader, which So basically has a URL and a completional block. Okay. So, Dispatchqe.global. Async which tries to get the data from the URL. Okay. There's no issue still now. Then we have a Image, UI Image. And then, we get the data. And over here is again like Image. We stand for the completion. And Okay. Explain the potential memory management problem, and how will you address? Okay. So there are 2 completion blocks over here, which can basically trap. So looking into it, the data part we are creating over here, it won't be ramped. URL maybe URL can be getting trapped over here. Uh, so URL is basically we are getting from the Function, uh, there is most self. So quite confused over here. Function. We are getting it from the function. Right? Let's write data image main. Sync. We're just dispatching it to the main thread. Okay. And image part. So we can basically have, like, big to the self. So, we don't capture URL over here. And this Should basically, like, uh, break the cycle because I feel the URL is basically getting captured from the Dispatch Global QR Sync. So making it a week may break a cycle.
Given this shift code snippet that applies a filter to an array integer, please identify the bug and explain how it might affect the functionality. Um, 1, 2, 3, 4, 5. Okay. Symbol that applies a filter to an array. Please identify the bug and explain how it might affect the functionality. What do you think the output will be, and what will be the actual result if there's a bug? So we have 1 to 5 and we are filtering it with mod 2 where it is equal to 0. So, it will basically return the even number. Filtered. Okay. So this case doesn't handle for, like, zeros. And if we have a 0, it may crash over here. So we will basically have to, like, have a condition for 0 where the filter is like dollar 0 is basically equal to equal to 0. We shouldn't return it over there or else like normally we can do the operation over
Discuss your approach to apply SOLID principle in IS architecture, and it's important in the core base. Uh, so solid stand for, like, sing sing, uh, single responsibility single responsibility. So whenever we we are creating a class, Uh, let's say, a Printer class, it should not depend on, uh, it should not implement, like, uh, be responsible for, like, doing, uh, downloading or uploading o is, uh, open close. So a class should be open for changes, but, uh, closed from being getting modified. For example, we have an interface, uh, sorry, we have a protocol, and we implement it to in the class. So it's open for the changes, but we shouldn't, like, make any extra property to, uh, do that changes. L is like list of Principle and, uh, Subsitution Principle. So, basically, it means that, uh, whenever you have a Superview, you Could be, basically, able to replace it with the Subview. Uh, the then it is like an, uh, Interface Aggregation. So Every method you are basically creating, it should be, like, uh, separated out to a protocol. So the testing is basically made easier. And these dependency inversions. So, instead of all your code being returned to a, uh, like, a class or something, the dependency should be, uh, returned down into a protocol. So the implementation and part is basically being, like, uh, separated out. So testing And, like, code reusabilities, uh, andmentability get increase over
What, uh, your latest update has caused of 50% of 50% upload and increase reported by analytics, what will be the step to diagnose and fix it? First of all, I will look into It's like, uh, what libraries that I have recently, like, integrated, uh, because libraries can, like, uh, increase the start time of the application. I will try to, like, investigate those things. Then I will check that if there are any uh network calls that are like taking higher time to like get by the response that will be 2nd. So we can basically if we have integrated Firebase, we can basically check the network calls and check How much time it is basically taking? So that way, we can, like, uh, check-in the production apps, like, if the network calls are making any changes. Uh, then 3rd will be, like, if we'll we will check, uh, like, if there was any logic introduced over there, like, in the AppDelegate file that is, like, taking a long time to, uh, process stuff. So the application is getting stuck over there. Or we will basically, second of all, check that if anything is being getting called from a background thread, it can also, like, uh, cause a delay in app starts. So that will be like few things. I will check if my launch tab of the application is being slowed down or and, yeah, we will also check for memory leaks. If any memory leaks are causing, like, the launch time to be increased, we can do it using, like, uh, memory graph debugger or, like, leak instruments.
In what scenario will you choose RxSwift or Combine? And how will you justify the choice? So, Combine is a framework that, uh, Apple introduced for reactive programming, same Rxshift does. So, uh, if your library like, if your deployment version is basically lower than IH twelve, you will basically, Um, target for Rxshift, because Combine you can't support over that. And but if you have, like, flexibility of Ios Deployment version you should go for Combine. Because Combine is Apple's priority framework. And, uh, we will have, like, More support and future support for Combine? Uh Combine has, like, multiple Publishers like same as Rxshift. So combine will be more greater solution because it directly integrates with, like, uh, shift 2 IUs. So, basically, whenever the state changes, Combine has a direct sync to it. Uh, with Direct Shift, we would have to, like, monitor changes and, like, Do it manually.
Explain your experience with g r gRPC framework and the advantages of using protocol buffer data format in client server communication for iOS apps. Okay. This is a good to have question answering. Won't affect this connection. Um so I haven't used with like uh gRPC Framework I don't actually have any idea about it um, but for, like, client server communication, we use, uh, REST APIs. Uh, but, like, advantages of using protocol buffer data, I don't know.