Advanced Swift TODO app to Interview

  • How do you think to write code? (core, extension etc.)
  • What is your architecture things? (like MVC, MVVM, VIPER)
  • How do you plan code design? (like a folder and file design)
  • Can you write testable code or are you have coding test know-how?
  • How do you use git(commit message, pull request etc)

Hacking Time

  • CRUD Operation
  • Coding Architecture
  • Clean Code( just not only pattern, formating, extension etc.)
  • Third-Party Usage
  • Testing

Folder Desing

I should prefer to project separate three layers: core layer, product layer and features.

Core Structure

  • Fetch function goals generic network request and response for the client(features layer).
  • Generate data: create a dictionary model for your post, put request.
service.fetch(path: "\(NetworkPath.TODO.rawValue)/\(index)", paramaters: nil, data: item, method: HTTPMethod.put) { (response: BaseResponse<[Todo]>) inonSuccess(response.model)} onError: { (error) inonError(error)}
  • initFromNib: use to nib file to the controller.
  • toJson: the need for firebase rest request end pint.
final class ApplicationConstants {static let BASE_CONFIG: BaseConfig = BaseConfig(baseUrl: "https://vb-test-1ca3f-default-rtdb.firebaseio.com", headers: nil)}

MVVM Structure (Features)

View

TodoViewController.xib

Service

Delegation and Navigate

  • TodoTableViewProtocol and TodoViewDataSoruce manage table view operation to work with a view.

Network Layer

  • Model (it’s created for return model types like a base response or base error etc.)
it returns every response
  • Need protocol to should manage service call.
  • The last code fetch function to all request.
service.fetch(path: "\(NetworkPath.TODO.rawValue)/\(index)", paramaters: nil, data: item, 
method: HTTPMethod.put)
{ (response: BaseResponse<[Todo]>) in
onSuccess(response.model)
} onError: { (error) in
onError(error)
}
  • Finally, create a utility layer for help to the service function.

Unit Testing

  • Service Testing(API consuming)
  • Unit Test(so business testing)

UI Testing

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Veli Bacık

Veli Bacık

We always change the world, so just want it. Google Developer Expert Flutter & Dart, Gamer, Work More!