├── .gitignore ├── Behavioral-Interview.md ├── Data-Structures-and-Algorithms.md ├── Firebase.md ├── LICENSE ├── Networking.md ├── Pair-Programming.md ├── Project-Walkthrough.md ├── README.md ├── Swift-Fundamentals.md ├── Tools.md ├── iOS-Fundamentals.md └── job-readiness-topics.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /Behavioral-Interview.md: -------------------------------------------------------------------------------- 1 | # Behavioral Interview 2 | 3 | > [Top Interview](https://www.topinterview.com/interview-advice/spotify-interview-questions-and-answers): 4 | 5 | > Situation: Think about a situation or challenge you've faced at work that directly relates to the question at hand. 6 | > This might include working with data, managing projects, communicating with difficult clients, or leading a team. 7 | 8 | >For example, one Glassdoor user said they were asked, “How do you rely on data in organizing projects?” during their Spotify interview. 9 | In that case, you'd want to think about a time you've used data to help organize your project, giving the interviewer a general 10 | overview of the situation. 11 | 12 | >Task: Talk about the task at hand and the role you played in handling the situation. For example, maybe your manager assigned you to 13 | reconfigure your team's workflow to eliminate some major inefficiencies. 14 | 15 | >Action: Here, you'll explain exactly what steps you took to carry out the task. If you used data to help organize a project, explain 16 | what programs you used and how you leveraged the data to offer project-management insights. 17 | 18 | >Result: Finally, describe the result. What impact did you make by using data to organize your projects? If you can, get as specific 19 | and concrete as possible, and use numbers to show your success. 20 | 21 | ## Question 1 22 | 23 | Why do you want to work at our company? 24 | 25 | *** 26 | 27 | ## Question 2 28 | 29 | Tell me about your previous experience. 30 | 31 | *** 32 | 33 | ## Question 3 34 | 35 | How do you manage conflict? 36 | 37 | > For this question you will want to use the **STAR** method. 38 | 39 | *** 40 | 41 | ## Question 4 42 | 43 | How would you launch a new product in a new market? 44 | 45 | *** 46 | 47 | ## Question 5 48 | 49 | What are some things you could've done better in your projects? 50 | 51 | *** 52 | 53 | ## Question 6 54 | 55 | Describe a project and the impact it had on the company. 56 | 57 | *** 58 | 59 | ## Question 7 60 | 61 | Tell me about yourself. 62 | 63 | *** 64 | 65 | ## Question 8 66 | 67 | What are your strengths and weaknesses? 68 | 69 | *** 70 | 71 | ## Question 9 72 | 73 | How do you handle people criticizing your work? 74 | 75 | *** 76 | 77 | ## Question 10 78 | 79 | Describe a time you went above and beyond for a client 80 | 81 | *** 82 | 83 | ## Question 11 84 | 85 | How comfortable are you working out of your comfort zone? 86 | 87 | *** 88 | 89 | ## Question 12 90 | 91 | Tell us about a time you showed leadership skills. 92 | 93 | *** 94 | 95 | ## Question 13 96 | 97 | What's your approach to managing people? 98 | 99 | *** 100 | 101 | ## Question 14 102 | 103 | What's your project management philosophy? 104 | 105 | *** 106 | 107 | ## Question 15 108 | 109 | How do you build team morale? 110 | 111 | *** 112 | 113 | ## Question 16 114 | 115 | How does goal-setting work on your team? 116 | 117 | *** 118 | 119 | ## Question 17 120 | 121 | What do you do if your team members have a conflict? 122 | 123 | *** 124 | 125 | ## Question 18 126 | 127 | Why do you think you're suited for this position? 128 | 129 | *** 130 | 131 | ## Question 19 132 | 133 | Are you familiar with our product? Tell us about it. 134 | 135 | *** 136 | 137 | ## Question 20 138 | 139 | What can you bring to our company that others can't? 140 | 141 | *** 142 | 143 | ## Question 21 144 | 145 | What would you do to improve our product? 146 | 147 | *** 148 | 149 | ## Question 22 150 | 151 | What would you do if you found out your closest friend at work was stealing? 152 | 153 | *** 154 | 155 | ## Question 23 156 | 157 | Tell me about a time you were 75 percent through a project and had to pivot quickly. How did you handle it? 158 | 159 | *** 160 | 161 | ## Question 24 162 | 163 | Tell me about a time when a team member wasn't pulling their weight. How did you handle it? 164 | 165 | *** 166 | 167 | ## Question 25 168 | 169 | Tell me about a decision you made based on your instincts. 170 | 171 | *** 172 | 173 | ## Question 26 174 | 175 | Tell me about a time you used a specific metric to drive change in your department. 176 | 177 | *** 178 | 179 | ## Question 27 180 | 181 | Tell me about a time when you influenced change by only asking questions. 182 | 183 | *** 184 | 185 | ## Question 28 186 | 187 | Provide an example of a time when you had to complete a project on a budget you felt was too tight. How did you make it work? 188 | 189 | *** 190 | 191 | ## Question 29 192 | 193 | Tell me about a time when you handled a project outside of your scope of work. How did you approach it? 194 | 195 | *** 196 | 197 | ## Question 30 198 | 199 | Do you know our CEO? How do you spell his name? 200 | 201 | *** 202 | 203 | ## Question 31 204 | 205 | How would you introduce our company in an elevator pitch? 206 | 207 | *** 208 | 209 | ## Question 32 210 | 211 | Which of our company's leadership principles do you align with most? 212 | 213 | *** 214 | 215 | ## Question 33 216 | 217 | What does our [name of company value] emphasize? 218 | 219 | > Please review and familiarize yourself with the company's mission, values and priciples. 220 | 221 | *** 222 | 223 | 224 | ## Question 34 225 | 226 | Do you know how many principles or values our company has? 227 | 228 | > Please review and familiarize yourself with the company's mission, values and priciples. 229 | 230 | *** 231 | 232 | 233 | # Questions for the interviewers 234 | 235 | 236 | ## Question 1 237 | 238 | What do you expect from someone in this position? 239 | 240 | *** 241 | 242 | ## Question 2 243 | 244 | What is a typical day like at your company? 245 | 246 | *** 247 | 248 | 249 | ## Question 3 250 | 251 | Where do you see the company in five years? 252 | 253 | *** 254 | 255 | 256 | ## Question 4 257 | 258 | What would you want to see me accomplish in the first six months here? 259 | 260 | *** 261 | 262 | 263 | ## Question 5 264 | 265 | What opportunities will I have to learn and grow? 266 | 267 | *** 268 | 269 | 270 | ## Question 6 271 | 272 | What do you feel is the biggest challenge our company is currently facing? 273 | 274 | *** 275 | 276 | ## Question 7 277 | 278 | What do you love about your role? 279 | 280 | *** 281 | 282 | 283 | ## Question 8 284 | 285 | How would you describe the team I would be working with? 286 | 287 | *** 288 | 289 | 290 | ## Question 9 291 | 292 | What is a typical day like in this role? 293 | 294 | *** 295 | 296 | 297 | ## Question 10 298 | 299 | What qualities are required to succeed at your company? 300 | 301 | *** 302 | 303 | ## Question 11 304 | 305 | Are there any new or unique customer trends you're currently experiencing or projecting? 306 | 307 | *** 308 | 309 | ## Question 12 310 | 311 | What are some of the biggest challenges you face at your company and some ways you solve or project to solve them? 312 | 313 | *** 314 | 315 | 316 | ## Question 13 317 | 318 | What are the next steps? 319 | 320 | > Very important question to ask as email exchange could be difficult at times to get the context you're looking for. 321 | 322 | *** 323 | 324 | 325 | # Resouces 326 | 327 | 1. [Top Interview Questions](https://www.topinterview.com/interview-advice/amazon-interview-questions-and-answers) 328 | 329 | 330 | 331 | 332 | 333 | 334 | -------------------------------------------------------------------------------- /Data-Structures-and-Algorithms.md: -------------------------------------------------------------------------------- 1 | ## Data Structures and Algorithms 2 | 3 | 4 | #### How do we measure algorithms ? 5 | 6 |
7 | Solution 8 | 9 | In computer science and programming the efficiency of an algorithm is measured using Big O notation. 10 | 11 |
12 | 13 | 14 | #### Why should developers care about data structures and algorithms ? 15 | 16 |
17 | Solution 18 | 19 | There are numerous data structures that can be choosen for a given problem, example should one use an array to store phone numbers or use a dictionary to map the names to phone numbers and so on. The more data structures one is exposed to the better the decision making process can be in choosing the right structure. As per algorithms, those are the steps in solving a given problem, some pre-defined algorithms exist such as binary search and shortest path, but everyday developers solve software development challenges and have to come up with steps and test cases for their given solution, so as with data structures, exposure and knowing how to measure efficiency of algorithms using Big O is vital to the success of a software engineer. 20 | 21 |
22 | 23 | 24 | #### Which sorting alogorithm uses a pivot and partitioning ? 25 | 26 |
27 | Solution 28 | 29 | Quick sort uses partioning to return a pivot as it continues to sort a collection using divide and conquer. 30 | 31 |
32 | 33 | #### What are the properties of a doubly linked node ? 34 | 35 |
36 | Solution 37 | 38 | A value (the data type of the Node), a next pointer and a previous pointer property. 39 | 40 |
41 | 42 | #### Name three built-in data structures in Swift ? 43 | 44 |
45 | Solution 46 | 47 | Arrays, Set and Dictionary. 48 | 49 |
50 | 51 | #### Name the types of depth-first traversals and explain how each works ? 52 | 53 |
54 | Solution 55 | 56 | In order, pre order and post order traversal. 57 | 58 | In-order traversal visits the **left** nodes then the **root** node then the **right** nodes. 59 | 60 | Pre-order traversal visits the **root** node first, then the **left** sub tree, then the **right** subtree. 61 | 62 | Post-order traversal visits the **left** subtree, then the **right**, then visits the **root** node. 63 | 64 |
65 | 66 | #### What is the runtime of `contains` on an array ? 67 | 68 |
69 | Solution 70 | 71 | O(n) 72 | 73 |
74 | 75 | #### What's the runtime of `contains` on a set ? 76 | 77 |
78 | Solution 79 | 80 | O(1) 81 | 82 |
83 | 84 | #### What's the requirements of a recursive function ? 85 | 86 |
87 | Solution 88 | 89 | Any recursion function must have a base case and the recursive call. 90 | 91 |
92 | 93 | 94 | #### Name a few sorting algorithms and their runtimes ? 95 | 96 |
97 | Solution 98 | 99 | Bubble sort, O(n ^ 2) 100 | Insertion sort, O(n ^ 2) 101 | Merge sort, O(n log n) 102 | Quick sort, O(n log n) 103 | 104 |
105 | 106 | 107 | #### What is divide and conquer and give an algorithm example ? 108 | 109 |
110 | Solution 111 | 112 | Divide and conquer is the process of taking a larger problem and breaking it down into smaller parts and solving sub parts until a solution is met. Examples of divide and conquer algorithms are merge sort, quick sort and binary search. 113 | 114 |
115 | 116 | -------------------------------------------------------------------------------- /Firebase.md: -------------------------------------------------------------------------------- 1 | ## Firebase 2 | 3 | #### What are the two types of databases that Firebase supports? 4 | 5 |
6 | Solution 7 | 8 | Firebase realtime database and Firebase firestore. 9 | 10 |
11 | 12 | 13 | #### Describe the importance of the `Google-Info.plist` file? 14 | 15 |
16 | Solution 17 | 18 | The `Google-Info.plist` is a property list that encompasses the configurations and connects your Xcode project and Firebase project. 19 | 20 |
21 | 22 | #### What are Firebase rules? 23 | 24 |
25 | Solution 26 | 27 | Firebase rules provides various levels of security on documents and collections in the Firebase database and storage services. 28 | 29 |
30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Alex Paul 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Networking.md: -------------------------------------------------------------------------------- 1 | ## Networking 2 | 3 | #### What are the valid top level types of JSON ? 4 | 5 |
6 | Solution 7 | 8 | The valid top level types are dictionary and array. 9 | 10 |
11 | 12 | #### What is HTTP? 13 | 14 |
15 | Solution 16 | 17 | HTTP is an internet protocol for allowing client/server communication. The client in this case our iOS app makes a request to a Web API / server and gets a response (json) back that we parse (convert) to Swift objects. 18 | 19 |
20 | 21 | #### What is `CRUD` ? 22 | 23 |
24 | Solution 25 | 26 | Create.Read.Update.Delete. This acronym encapsulated the cycle of object creation and modification. 27 | 28 |
29 | 30 | 31 | #### Name some HTTP methods ? 32 | 33 |
34 | Solution 35 | 36 | GET, POST, DELETE, PUT, UPDATE. 37 | 38 |
39 | 40 | 41 | #### What is a status code and give an example ? 42 | 43 |
44 | Solution 45 | 46 | Status codes are recieved via an http response from a server request to indicate the state and validity of the request. 500 status code implies there's an issue with the server. 47 | 48 |
49 | 50 | 51 | #### What are two ways in which web content is formatted for delivery to a client ? 52 | 53 |
54 | Solution 55 | 56 | XML and JSON, the latter being the more popular and easier to understand and parse. 57 | 58 |
59 | 60 | 61 | 62 | #### Explain RESTFul APIs ? 63 | 64 |
65 | Solution 66 | 67 | REST is an standard architecture that web developers use present data to a client. 68 | 69 |
70 | 71 | #### What is a MIME type ? 72 | 73 |
74 | Solution 75 | 76 | MIME (Multipurpose Internet Mail Extensions) type is a label used to describe the media content of a piece of data. 77 | 78 |
79 | 80 | #### What's the difference between Websockets and HTTP ? 81 | 82 |
83 | Solution 84 | 85 | Websockets allow for a constant two-way stream of data and HTTP transfers data via a request -> response model. 86 | 87 | e.g Stock market ticker uses websockets for real time data streaming. 88 | 89 | e.g Fetching a new Instagrm photo using http protocol, client request, server response. 90 | 91 |
92 | -------------------------------------------------------------------------------- /Pair-Programming.md: -------------------------------------------------------------------------------- 1 | # Pair Programming Exercise 2 | 3 | ## Prerequisites for this exercise 4 | 5 | * Xcode preferably the most up to date version. 6 | * Terminal and git experience. 7 | * Swift fundamentals. 8 | * iOS and UIKit experience. 9 | * Using dependencies e.g CocoaPods or Swift Package Manager. 10 | * Multithreading and Asynchronous programming. 11 | * Networking in iOS. 12 | * Unit Testing. 13 | * Ability to debug a given code base. 14 | * Experience with the Human Interface Guidelines (HIG) and Apple design best practices. 15 | * MVC or MVVM experience. 16 | * Eye for subtle effective use of animataions. 17 | * Experience using Postman or similar. 18 | 19 | 20 | ## Checklist of topics to know 21 | 22 | - [ ] Parsing JSON data from a Web API 23 | - [ ] Populate a Table View with given data. 24 | - [ ] Populate a Collection View with data and create custom cell. 25 | - [ ] Use URLSession natively without any third party libraries. 26 | - [ ] Comfortable using breakpoints and `po` as a debugging tool. 27 | - [ ] Be able to segue and pass data to a view controller. 28 | - [ ] Use of gesture recogizers e.g long press, tap. 29 | - [ ] Use delegation pattern or callbacks to communicate data. 30 | - [ ] Be comfortable setting up views using Storyboards, nibs. 31 | - [ ] Be comfortable setting up views programmatically. 32 | - [ ] Source control management using git and Github. 33 | - [ ] Be able to create animations using UIKit built-in APIs. e.g UIView.animate 34 | - [ ] Familiarity with dependency managers e.g Cocoapods or Swift Package Manager in order to use third party libraries. 35 | 36 | ## Reading resources 37 | 38 | 1. [Things I’ve learned from pair programming interviews](https://www.freecodecamp.org/news/things-ive-learned-from-pair-programming-interviews-35a4db7d7443/) 39 | -------------------------------------------------------------------------------- /Project-Walkthrough.md: -------------------------------------------------------------------------------- 1 | # Project Walkthrough 2 | 3 | 1. How are you storing information? 4 | 1. How do you persist information through relaunches? 5 | 1. What frameworks did you use to build your application? 6 | 1. Walk me through the most complex part of your application? 7 | 1. How do you learn about new topics? 8 | 1. Walk me through the most challenging part of the app? 9 | 1. What problem did third party libraries solve that you couldn’t just do natively? 10 | 1. How many users could your app support? 11 | 1. Which git strategy did you use? 12 | 1. What would happen if you were to increase your user base by 10x? 100x? 1000x? 13 | 1. How do you pass information from one screen to another? 14 | 1. Explain your app architecture to me. 15 | 1. Did you get to MVP and how long did it take to hit MVP? 16 | 1. How did you manage version control? 17 | 1. Walk us through the parts of the app you worked on? 18 | 1. How did you track and manage tickets? 19 | 1. How do you go about learning about new APIs and Frameworks? 20 | 1. What does it mean to mark your class `final`? 21 | 1. Did you encounter any race conditions you had to resolve? 22 | 1. What kind of testing did you use in your application? 23 | 1. Did you use unit testing in the app? 24 | 1. How does your app anticipate incorrect user behavior? 25 | 1. Describe your code review process? 26 | 1. What's the inspiration behind your app logo? 27 | 1. How does your app connect to/get info from other devices? 28 | 1. How did you deal with technical debt in your app? 29 | 1. What technical debt does your application still have? 30 | 1. What is the code coverage of your app? 31 | 1. If you could start over, what would you have done differently? 32 | 1. Did work with any languages that weren’t Swift? 33 | 1. Were there any interesting algorithms that came up in your app? 34 | 1. Explain the process of deploying your app from Xcode to TestFlight? 35 | 1. Do you use continuous integration? If so which do use and why? 36 | 1. What is Firebase? 37 | 1. How did you go scaling your app? 38 | 1. How does Firebase database work? 39 | 1. What's the difference between websockets and http? 40 | 1. What's the lowest version of iOS your app supports and why? 41 | 1. How do you monitor crashes in your app? 42 | 1. Which dependency manager(s) are you in your app? 43 | 1. What are some of the key third party libraries you use in your app? 44 | 1. How many dependencies do you use in your app? 45 | 1. How are you handling authentication in your app? 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS Interview Preparation 2 | 3 | > Objective is to add as many questions to this repo to better prepare for iOS interview preparation. If you see an issue or want to add some additional questions, feel free to open a PR or an issue. Thanks for visiting and staring ⭐️ this repo so others can find it :-] 4 | 5 | Buy Me A Coffee 6 | 7 | 8 | ## Some elements of Job Search  9 | 10 | * Applying for jobs  11 | * Data Structures and Algorithms practice  12 | * Stack specific questions e.g. “memory management in iOS” 13 | * Software development (building projects, reading on and practicing new APIs and Frameworks)  14 | * Computer Science topics e.g. “what’s a process” 15 | * Networking, Networking, Networking……. 16 | * Writing (articles, blogs) 17 | * Project walkthroughs 18 | 19 | ## 1. [Swift Fundamentals](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Swift-Fundamentals.md) 20 | 21 | ## 2. [iOS Fundamentals](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/iOS-Fundamentals.md) 22 | 23 | ## 3. [Tools](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Tools.md) 24 | 25 | ## 4. [Networking](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Networking.md) 26 | 27 | ## 5. [Firebase](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Firebase.md) 28 | 29 | ## 6. [Data Structures and Algorithms](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Data-Structures-and-Algorithms.md) 30 | 31 | ## 7. [Project Walkthrough](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Project-Walkthrough.md) 32 | 33 | ## 8. [Pair Programming](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Pair-Programming.md) 34 | 35 | ## 9. [Behavioral Interview](https://github.com/alexpaul/iOS-Interview-Preparation/blob/master/Behavioral-Interview.md) 36 | 37 | -------------------------------------------------------------------------------- /Swift-Fundamentals.md: -------------------------------------------------------------------------------- 1 | ## Swift Fundamentals 2 | 3 | 4 | #### 1. What's the difference between mutable and immutable ? 5 | 6 |
7 | Solution 8 | 9 | A mutable object allows for change. An immutable object does not allow for changes. 10 | 11 | Mutable object L 12 | ```swift 13 | var currentYear = 2020 14 | currentYear = 2021 // could not come fast enough 15 | ``` 16 | 17 | Immutable object 18 | ```swift 19 | let usIndependenceDay = "July 4th" 20 | usIndependenceDay = "February 22nd" // sorry could not compile, this is 🇱🇨 Independence day 21 | ``` 22 | 23 |
24 | 25 | #### 2. What is a property observer? 26 | 27 |
28 | Solution 29 | 30 | A property observer listens for changes on a object. One can listen for changes when the object is about to get set and when the object actuallly got set. 31 | 32 | ```swift 33 | var age = 20 { 34 | willSet { 35 | print("it's about to get fun") 36 | } 37 | didSet { 38 | print("with great power comes great responsibility") 39 | } 40 | } 41 | 42 | age = 21 43 | 44 | /* 45 | it's about to get fun 46 | with great power comes great responsibility 47 | */ 48 | ``` 49 | 50 |
51 | 52 | 53 | #### 3.What is a computed property ? 54 | 55 |
56 | Solution 57 | 58 | A computed property returns the value of a block of calculated logic. 59 | 60 | ```swift 61 | var count: Int { 62 | return elements.count 63 | } 64 | ``` 65 | 66 |
67 | 68 | #### 4. What are higher order functions? 69 | 70 |
71 | Solution 72 | 73 | A function that takes another function as an argument or returns a function is said to be a higher order function. This is the fundamental pillar of functional programming. 74 | 75 |
76 | 77 | #### 5. What is recursion? 78 | 79 |
80 | Solution 81 | 82 | A function that calls itself. The two main parts of a recursive function is the **base case** and the **recursive call**. 83 | 84 | ```swift 85 | func jobSearch(_ isHired: Bool) { 86 | // base case 87 | guard !isHired else { 88 | print("Woohoo") 89 | print("Everyone's journey is different") 90 | return 91 | } 92 | // recursive call 93 | print("Job searching...") 94 | jobSearch(Bool.random()) 95 | } 96 | 97 | jobSearch(false) 98 | 99 | /* 100 | Job searching... 101 | Job searching... 102 | Job searching... 103 | Woohoo 104 | Everyone's journey is different 105 | */ 106 | ``` 107 | 108 |
109 | 110 | #### 6. What are access control / modifiers and give three examples? 111 | 112 |
113 | Solution 114 | 115 | Access control provide varied level of access to parts of the code of an object from another source object. 116 | 117 | Three examples are: 118 | * private 119 | * public 120 | * internal 121 | 122 |
123 | 124 | #### 7. Name three built-in protocols in Swift and their use cases? 125 | 126 |
127 | Solution 128 | 129 | `Hashable`. Types conforming to `Hashable` will be guaranteed to be unique. 130 | `CaseIterable`. Enums conforming to `CaseIterable` will make all their cases available and iterable. 131 | `CustomStringConvertible`. Conforming to `CustomStringConvertible` allows a type to override the description property on an object and return a custom String. 132 | 133 |
134 | 135 | 136 | #### 8. What's the benefit of an inout function? 137 | 138 |
139 | Solution 140 | 141 | To be able to mutate via referencing the data outside the scope of a function. 142 | 143 |
144 | 145 | #### 9. Write code to access the last element of an array ? 146 | 147 |
148 | Solution 149 | 150 | Example 1: 151 | ```swift 152 | let arr = [1, 2, 3, 4] 153 | print(arr[arr.count - 1]) // assuming the array is not empty, will crash otherwise 154 | ``` 155 | 156 | Example 2: 157 | ```swift 158 | let arr = [1, 2, 3, 4] 159 | print(arr.last ?? -1) // using nil-coelescing here as last is an optional 160 | ``` 161 | 162 |
163 | 164 | #### 10. What is an optional ? 165 | 166 |
167 | Solution 168 | 169 | In Swift an optional is a type used to indicate that an object can or not have a value. 170 | 171 |
172 | 173 | #### 11. What are Closures ? 174 | 175 |
176 | Solution 177 | 178 | Closures are anonymous functions (functions without a name) that capture references to values in their surrounding context. This is one of the subtle differences between functions and closures. Please note however that nested functions also capture their surrounding values. 179 | 180 | ```swift 181 | // someFunc definition with a closure parameter 182 | func someFunc(action: (Int, Bool) -> ()) { 183 | let internalValue = 20 184 | action(8 + internalValue, Bool.random()) // the action closure captures the Int and Bool values 185 | } 186 | 187 | 188 | // someFunc call using trailing closure syntax 189 | someFunc { intValue, boolValue in 190 | print("closure captured values are \(intValue) and \(boolValue)") // closure captured values are 28 and false 191 | } 192 | ``` 193 | 194 |
195 | 196 | #### 12. What is GCD? 197 | 198 |
199 | Solution 200 | 201 | Grand central dispacth is the library that iOS uses to handle concurrency. 202 | 203 |
204 | 205 | #### 13. Name the types of loops available in Swift ? 206 | 207 |
208 | Solution 209 | 210 | while, for-in and repeat-while 211 | 212 |
213 | 214 | 215 | #### 14. If using a Command-line macOS application what's the function used for taking user input ? 216 | 217 |
218 | Solution 219 | 220 | For user input or STDIN when working in a command-line application we use `readLine()`. 221 | 222 |
223 | 224 | #### 15. What is the restriction on a dictionary ? 225 | 226 |
227 | Solution 228 | 229 | The keys need to conform to `Hashable`. 230 | 231 |
232 | 233 | 234 | #### 16. What is Object Oriented Programming ? 235 | 236 |
237 | Solution 238 | 239 | A paradigm used in programming to represent objects and encapsulate their properties and functions. 240 | 241 | ```swift 242 | // Parent class 243 | class Person { 244 | var name: String 245 | var age: Int 246 | 247 | init(name: String, age: Int) { 248 | self.name = name 249 | self.age = age 250 | } 251 | 252 | func info() { 253 | print("Hi, my name is \(name)") 254 | } 255 | } 256 | 257 | // Fellow inherits from the Person class 258 | // Subclass 259 | class Fellow: Person {} 260 | 261 | let fellow = Fellow(name: "Xavier Li", age: 23) 262 | fellow.info() // Hi, my name is Xavier Li 263 | ``` 264 | 265 |
266 | 267 | #### 17. Name three principles of OOP ? 268 | 269 |
270 | Solution 271 | 272 | Inheritance, Encapsulation and Polymorphism. 273 | 274 |
275 | 276 | 277 | 278 | #### 18. What is Protocol Oriented Programming ? 279 | 280 |
281 | Solution 282 | 283 | In Swift this is a paradigm used to describe the blueprint of functions and properties that a conforming object needs to adhere to. 284 | 285 | ```swift 286 | import UIKit 287 | 288 | protocol Vehicle { 289 | var wheels: Int { get } 290 | var color: UIColor { set get } 291 | func drive(speed: Int) 292 | } 293 | 294 | struct Bike: Vehicle { 295 | let wheels = 2 296 | var color = UIColor.systemGray 297 | 298 | func drive(speed: Int) { 299 | print("current speed is \(speed)") 300 | } 301 | } 302 | 303 | let bike = Bike() 304 | 305 | bike.drive(speed: 23) // current speed is 23 306 | ``` 307 | 308 |
309 | 310 | 311 | #### 19. What is dependency injection? 312 | 313 |
314 | Solution 315 | 316 | Dependency Injection is used to pass all required properties and data over to an object. This is better done through the use on an initializer as the object can fully encapsulate its properties. 317 | 318 |
319 | 320 | 321 | #### 20. What framework is used for writing Unit Test in iOS ? 322 | 323 |
324 | Solution 325 | 326 | XCTest 327 | 328 |
329 | 330 | #### 21. What is a Singleton? 331 | 332 |
333 | Solution 334 | 335 | A singleton is making use of one instance of a class throughout the life of the launch of an application. One of the main pillars of singleton is the use of marking initializers private so accidental creation of multiple instances is prohibited. 336 | 337 | Singletons are used throughout iOS in places like `UserDefaults.standard`, `FileManager.default` and `UIApplication.shared`. 338 | 339 | ```swift 340 | class GameSession { 341 | static let shared = GameSession() 342 | private init() { 343 | // initialization of properties here 344 | } 345 | } 346 | 347 | let session = GameSession.shared 348 | 349 | let otherSession = GameSession() // 'GameSession' initializer is inaccessible due to 'private' protection level 350 | ``` 351 | 352 |
353 | 354 | #### 22. Is `URLSession` part of `Foundation` or `UIKit`? 355 | 356 |
357 | Solution 358 | 359 | URLSession is part of the Foundation framework. 360 | 361 |
362 | 363 | #### 23. What's the difference between a compile time error and a runtime error? 364 | 365 |
366 | Solution 367 | 368 | Compile time errors occurs during the writing phase of your code. Runtime erros occurs during the launch and actual use of the application. 369 | 370 |
371 | 372 | #### 24. Is `Index out of range` error on an array an compile-time error or a runtime error? 373 | 374 |
375 | Solution 376 | 377 | `Index out of range` is a runtime error. 378 | 379 |
380 | 381 | 382 | #### 25. What's the difference between Structs and Classes? 383 | 384 |
385 | Solution 386 | 387 | Structs are passed-by value (value-types) meaning copies of the objects are passed around thereby making the objects immutable by default. Classes are reference types and their state is easily mutated as objects that have the same reference can make changes at will. 388 | 389 |
390 | 391 | 392 | #### 26. What is Type Annotation? 393 | 394 |
395 | Solution 396 | 397 | Type annotation is explicity marking the data type of a variable or constant upon initialization. 398 | 399 | ```swift 400 | let emojiCharacter: Character = "🚀" 401 | ``` 402 | 403 |
404 | 405 | #### 27. What is Type Inference? 406 | 407 |
408 | Solution 409 | 410 | Type inference is allowing the Swift compiler to determine the data type. 411 | 412 | ```swift 413 | let names = ["Bob", "Anne", "Ashley"] // in this example the names is infereed to be of type [String] 414 | ``` 415 | 416 |
417 | 418 | 419 | #### 28. Is `NSString` a class or a struct? 420 | 421 |
422 | Solution 423 | 424 | `NSString` is an objective-c API and is a class. With interopobality we can easily bridge between Swift `String` and `NSString`. 425 | 426 |
427 | 428 | 429 | #### 29. What's the difference between frames and bounds? 430 | 431 |
432 | Solution 433 | 434 | The frame represents an object's superview and it's relationship in the coordinate space, whereas the bounds represents the objects own size and location. 435 | 436 |
437 | 438 | #### 30. What modifier can we use to prevent a class from being subclassed? 439 | 440 |
441 | Solution 442 | 443 | ```swift 444 | final class BlackJack { 445 | // properties 446 | // initializer 447 | // methods 448 | } 449 | 450 | class MyBlackJack: BlackJack { // COMPILER ERROR: cannot inherit from a final class 451 | 452 | } 453 | ``` 454 | 455 |
456 | 457 | -------------------------------------------------------------------------------- /Tools.md: -------------------------------------------------------------------------------- 1 | ## Tools 2 | 3 | #### Name two dependency managers, can you name three ? 4 | 5 |
6 | Solution 7 | 8 | Swift Package Manager, Cocoa Pods and Carthage. 9 | 10 |
11 | 12 | #### What's the difference between `git` and `Github`? 13 | 14 | 15 |
16 | Solution 17 | 18 | `git` is an open source versioning system. `Github` is an online versioning platform for project collaboration now owned by Mr. Softie. Other competitors to `Github` are: `BitBucket` and `GitLab`. 19 | 20 |
21 | 22 | 23 | 24 | #### What is Continuous Integration (CI) / Continuous Deployment (CD) ? 25 | 26 |
27 | Solution 28 | 29 | Continuous Integration (CI) / Continuous Deployment (CD) is the automation process of connecting your software stack along with testing to ease versioning and deploying software, in our case automatically creating TestFlight builds or App Store builds. 30 | 31 |
32 | 33 | #### What is the terminal command for creating a local `git` repository ? 34 | 35 | 36 |
37 | Solution 38 | 39 | `git init` 40 | 41 |
42 | 43 | #### What is the terminal command for creating a Podfile in an Xcode project? 44 | 45 | 46 |
47 | Solution 48 | 49 | `pod init` 50 | 51 |
52 | 53 | #### What is the `Podfile.lock`? 54 | 55 | 56 |
57 | Solution 58 | 59 | This `Podfile.lock` tracks the versions of installed `pods` in your project. 60 | 61 |
62 | 63 | #### What is Postman? 64 | 65 |
66 | Solution 67 | 68 | Postman is an API development platform, as iOS developers this is our go to for testing JSON payload data from Web APIs. 69 | 70 | Example endpoint 71 | `GET https://itunes.apple.com/search?media=podcast&limit=200&term=swift` 72 | 73 | Example JSON 74 | 75 | ```json 76 | { 77 | "resultCount": 171, 78 | "results": [{ 79 | "wrapperType": "track", 80 | "kind": "podcast", 81 | "artistId": 1019380766, 82 | "collectionId": 1209817203, 83 | "trackId": 1209817203, 84 | "artistName": "Spec, JP Simard, Jesse Squires", 85 | "collectionName": "Swift Unwrapped", 86 | "trackName": "Swift Unwrapped", 87 | "collectionCensoredName": "Swift Unwrapped", 88 | "trackCensoredName": "Swift Unwrapped", 89 | "artistViewUrl": "https://podcasts.apple.com/us/artist/spec/1019380766?uo=4", 90 | "collectionViewUrl": "https://podcasts.apple.com/us/podcast/swift-unwrapped/id1209817203?uo=4", 91 | "feedUrl": "https://feeds.simplecast.com/3pGv88mm", 92 | "trackViewUrl": "https://podcasts.apple.com/us/podcast/swift-unwrapped/id1209817203?uo=4", 93 | "artworkUrl30": "https://is1-ssl.mzstatic.com/image/thumb/Podcasts123/v4/4f/33/5c/4f335ccf-a9b8-672b-9c79-635925a70787/mza_3481066685613843705.jpg/30x30bb.jpg", 94 | "artworkUrl60": "https://is1-ssl.mzstatic.com/image/thumb/Podcasts123/v4/4f/33/5c/4f335ccf-a9b8-672b-9c79-635925a70787/mza_3481066685613843705.jpg/60x60bb.jpg", 95 | "artworkUrl100": "https://is1-ssl.mzstatic.com/image/thumb/Podcasts123/v4/4f/33/5c/4f335ccf-a9b8-672b-9c79-635925a70787/mza_3481066685613843705.jpg/100x100bb.jpg", 96 | "collectionPrice": 0.00, 97 | "trackPrice": 0.00, 98 | "trackRentalPrice": 0, 99 | "collectionHdPrice": 0, 100 | "trackHdPrice": 0, 101 | "trackHdRentalPrice": 0, 102 | "releaseDate": "2020-09-14T17:26:00Z", 103 | "collectionExplicitness": "cleaned", 104 | "trackExplicitness": "cleaned", 105 | "trackCount": 89, 106 | "country": "USA", 107 | "currency": "USD", 108 | "primaryGenreName": "Technology", 109 | "contentAdvisoryRating": "Clean", 110 | "artworkUrl600": "https://is1-ssl.mzstatic.com/image/thumb/Podcasts123/v4/4f/33/5c/4f335ccf-a9b8-672b-9c79-635925a70787/mza_3481066685613843705.jpg/600x600bb.jpg", 111 | "genreIds": [ 112 | "1318", 113 | "26" 114 | ], 115 | "genres": [ 116 | "Technology", 117 | "Podcasts" 118 | ] 119 | }] 120 | } 121 | ``` 122 | 123 |
124 | 125 | -------------------------------------------------------------------------------- /iOS-Fundamentals.md: -------------------------------------------------------------------------------- 1 | ## iOS Fundamentals 2 | 3 | #### 1. What are the two native frameworks used to create user interfaces in iOS? 4 | 5 |
6 | Solution 7 | 8 | UIKit and SwiftUI. 9 | 10 |
11 | 12 | #### 2. What does the `IB` in `IBOutlet` or `IBAction` stand for? 13 | 14 |
15 | Solution 16 | 17 | Interface Builder and NS stands for Next Step in the job process. Reminder to be nice. 18 | 19 |
20 | 21 | #### 3. What are the two required methods of a `UITableViewDataSource`? 22 | 23 |
24 | Solution 25 | 26 | The two required methods are `numberOfRowsInSection()` and `cellForRowAt()`. 27 | 28 |
29 | 30 | #### 4. What's the difference Push notifications and Local Notifications ? 31 | 32 |
33 | Solution 34 | 35 | Push notifications is triggers by a server and delivered remotely to the client iOS app whereas Local notifications are triggers by iOS and delivered locally via one of the three notification triggers, namely, location, timer interval or calendar event. 36 | 37 |
38 | 39 | #### 5. Name the ways to persist data in iOS ? 40 | 41 |
42 | Solution 43 | 44 | UserDefaults, Documents directory and Core Data. 45 | 46 |
47 | 48 | #### 6. What is `Result` type? 49 | 50 |
51 | Solution 52 | 53 | Result type is an `enum` type that has a success and failure case with respective associated values. 54 | 55 | ```swift 56 | enum AppError: Error { 57 | case fetchError 58 | } 59 | 60 | func fetchData(completion: @escaping (Result) -> ()) { // Result type used to capture state or success or failure 61 | let success = Bool.random() 62 | if success { 63 | completion(.success("Success")) 64 | } else { 65 | completion(.failure(.fetchError)) 66 | } 67 | } 68 | 69 | fetchData { result in 70 | switch result { 71 | case .success (let str): 72 | print(str) // "Success" 73 | case .failure (let error): 74 | print("error found: \(error)") // error found: fetchError 75 | } 76 | } 77 | ``` 78 | 79 |
80 | 81 | #### 7. Describe the ways in which a view can be created ? 82 | 83 |
84 | Solution 85 | 86 | Programmatically, using Storyboard or a xib. 87 | 88 |
89 | 90 | #### 8. What is ARC ? 91 | 92 |
93 | Solution 94 | 95 | Prior to Automatic reference counting in Objective-C developers needed to keep track of retain and release cycles of objects that were created. With the introduction of ARC now the system does most of the automatic retain/release counting and mememory management for us with limitations such as capturing closures where we need to use weak/unowned as needed. 96 | 97 |
98 | 99 | #### 9. What is MVC? 100 | 101 |
102 | Solution 103 | 104 | MVC which stand for Model, View, Controller has been an architecture used for the last 30 years. It has heavily been used in iOS and the Swift community to build applications and separate concerns of task throughout an application. 105 | 106 | Model. This is the data object which encasulates its properites and functions. 107 | View. This is the user interface of the application. This is the way in which the user interacts with our app. 108 | Controller. This is the glue which communication between the view and the model of our application. 109 | 110 | Most recently along swith SwiftUI MVVM is being quickly adopted as the newer approach to architecting our applications. 111 | 112 |
113 | 114 | #### 10. What is `URLSession` ? 115 | 116 |
117 | Solution 118 | 119 | The class that manages Networking in iOS. 120 | 121 |
122 | 123 | #### 11. Name three types of gesture recognizers ? 124 | 125 |
126 | Solution 127 | 128 | UITapGestureRecognizer, UISwipeGestureRecognizer and UILongPressGestureRecognizer. 129 | 130 |
131 | 132 | #### 12. Which built-in tool do we use to test performance of our application ? 133 | 134 |
135 | Solution 136 | 137 | We use Instruments to test and analize performance of various parts of our app. Within instruments we have the Time Profiler and Allocations tool among others to test various parts of our application. 138 | 139 |
140 | 141 | #### 13. What is Core Data ? 142 | 143 |
144 | Solution 145 | 146 | Core Data is an object-relational graph model of representing and persisting data in an appliation. 147 | 148 |
149 | 150 | #### 14. What is TestFlight and describe its process ? 151 | 152 |
153 | Solution 154 | 155 | TestFlight is used as a method of beta testing an application as it gets ready for production. 156 | 157 | The process begins from archiving a project in Xcode and uploading the binary to App Store Connect. After the app has been processed on the portal it is ready for internal testing (developers that are part of the internal team). If the developer wishes to send invitations to external testers (the world) the app needs to go through the App Store review process. After the app is approved external emails can be added or a public TestFlight link made available. 158 | 159 |
160 | 161 | #### 15. What are the types of Local Notifications ? 162 | 163 |
164 | Solution 165 | 166 | There are three local notifications, calendar notification, location notification and time interval notification. 167 | 168 |
169 | 170 | #### 16. What is the default http method when making a request? ? 171 | 172 |
173 | Solution 174 | 175 | By default when using URLSession to make a network request the HTTP method is a GET request. 176 | 177 |
178 | 179 | -------------------------------------------------------------------------------- /job-readiness-topics.md: -------------------------------------------------------------------------------- 1 | # Job Readiness Topics 2 | 3 | * Unit Testing / XCTest 4 | * TDD / BDD 5 | * Persistence: FileManager, UserDefaults, CoreData 6 | * Closures 7 | * Delegation 8 | * NotificationCenter 9 | * URLSession 10 | * RestFul API 11 | * HTTP Methods 12 | * Parsing JSON 13 | * Codable: Encodable & Decodable 14 | * Protocols 15 | * Inheritance 16 | * Structs and Classes 17 | * Concurrency: Dispatch, DispatchQueue, Race Condition, Threading, Process, Semaphore... 18 | * TableView 19 | * UICollectionView 20 | * UIStackView 21 | * NSCache 22 | * Dependency Injection 23 | * Singleton 24 | * Initialialization 25 | * Error Handling 26 | 27 | 28 | ## Newer APIs/Frameworks 29 | 30 | * Combine 31 | * SwiftUI 32 | * Swift Concurrency (async/await, actors, task...) 33 | --------------------------------------------------------------------------------