InterviewSolution
| 1. |
This below given difficult code sorts an array of fruits. Write down ways to code the given logic in a simpler way than the code given below. |
|
Answer» var fruits = ["apples", "oranges", "PAPAYA", "kiwi"]fruits.sort { (a: String, b: String) -> Bool in return a < b}print(fruits) There are three ways in which we can simplify the given code snippet: fruits.sort { (a,b) in return a < b }fruits.sort { $0 < $1 }fruits.sort(by: <)Conclusion:Apple gadgets are used by BILLIONS of people all over the world. The number of iOS users has been constantly INCREASING, which is good news for iOS application developers. iOS Swift developers MUST also keep up with the latest developments in the iOS Swift community. Make sure you are keeping up with Apple developer news, podcasts, and blogs. This is unlikely to be a question in an interview, but it distinguishes you. We hope that the Swift Interview questions answered here are extremely helpful in studying the fundamentals and advanced topics of iOS Swift. Any beginner or experienced professional who understands these Swift and iOS developer interview questions will be able to pass the interview on the first try. All the best for your upcoming interviews! |
|