Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added AppScreens/TheMovieAppMockup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 30 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
# Work sample - Application developer

## Assignment

- Build an awesome movie app that shows popular and high rated movies.
- Code it for the platform (Android, iOS, web) you applied for or the one you prefer.

## Requirements

- Use an open https://developers.themoviedb.org/open source API. Please read the API [Authentication section](https://developers.themoviedb.org/3/getting-started/authentication) to get started.
- Discover most popular and highly rated movies.
- Display the movies with creative look and feel of an app to meet design guidelines for your platform (Material Design etc.).
- Launch a detail screen whenever a particular movie is selected.

## Examples of bonus features

- Allow user to save a favorite movie for offline access.
- Allow user to read movie reviews.

## We expect you to

- Write clean code.
- Create a responsive design.
- Handle error cases.
- Use the latest libraries and technologies.
- Tested code is a big plus.

### User experience

The features of the app might be few, but we expect you to deliver a solution with a high user experience. Imagine this application to be used by real users, with real needs. Make it interesting, fun and intuitive to use. And of course you are allowed to extend your applications functionality.

### Code

We expect that the code is of high quality and under source control. Expect the solution to be continuously worked on by other developers and should therefore be easy to understand, adjust and extend. True beauty starts on the inside!

## Delivery

Fork the repository, code in your fork and make a pull request when done. A nice commit history describing your work is preferred over squashing it into one commit.
Also send us an e-mail to let us know!

### Good luck!

---

# The Movie DB

<div style="width:830px; background-color:white; height:120px; overflow:auto;">
<div style="width: 2000px; height: 90px;">
<img src="https://github.com/AliSani/tech-work-sample/blob/master/AppScreens/TheMovieAppMockup.png" width=500/>
</div>

# Features
- [x] Home view: Shows list of movies could be filtered by popular or top rated by a segment
- [x] Movie details view: Shows details of a movie including the overview, genres and posters.
- [x] Pagination for movie lists
- [x] Memory caching for filtering: No extra requests are sent to backend when filter is changed if data already exists in memory.
- [x] Architecture: MVVM, protocol oriented, covering SOLID principles, inversion of control (dependency injection via protocols instead of concerete types), error handlings.
- [x] Unit Test demonstration for movie details view model
- [x] UI Test demonstration


# Tech discussions

* Due to my UI/UX design experience we have discussed earlier, I used my budget for both tech and design parts to demonstrate both.
* Due to simplicity of the requirements no complex or advanced networking is been implemented and the shared `URLSession` has been used. Usually I go with using Almofire which was an overkill for this project.
* For the binding between view and viewmodel I have used clousures.
* There is no coordinator implemeted since there is very few navigations in the project.
* Dependency Injection: Please check the view models where there API services are injected as protocols instead of concerete types. So we can easily create fakes for our unit testing purposes.
* I have put a few unit tests to just demonstrate the testability of the the view models but in a real project full unit test coverage for view models is preffered.
* I have put a few UI tests to just demonstrate it but due to shortage of time I did not use mocked data and am testing against real data which should definitely be changed, thus I have put a TODO in code instead of putting more time than the budget.
* I have used storyboard and XIB for creating the most of UI parts but have also created the `LoadingView` programmatically to just demonstrate the preffered way of creating UIs for biggers teams to avoid conflicts.

## How to run:
Clone the repo and open TheMovieDB.xcodeproj.
787 changes: 787 additions & 0 deletions TheMovieDB/TheMovieDB.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "6DBA445E-9181-48EE-9D92-9986682FFDF3"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E9A40BCB-FA05-475B-A0AA-99815FDB93BD"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "TheMovieDB/Features/Movie Details/MovieDetailsViewModel.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "40"
endingLineNumber = "40"
landmarkName = "fetchMovieDetails(withID:)"
landmarkType = "7">
<Locations>
<Location
uuid = "E9A40BCB-FA05-475B-A0AA-99815FDB93BD - e89285f381527841"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "TheMovieDB.MovieDetailsViewModel.fetchMovieDetails(withID: Swift.Int) -&gt; ()"
moduleName = "TheMovieDB"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/Sani/Documents/Software/tech-work-sample/TheMovieDB/TheMovieDB/Features/Movie%20Details/MovieDetailsViewModel.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "40"
endingLineNumber = "40"
offsetFromSymbolStart = "227">
</Location>
<Location
uuid = "E9A40BCB-FA05-475B-A0AA-99815FDB93BD - da978c99a86fca5f"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "closure #1 (Swift.Result&lt;TheMovieDB.MovieDetails, TheMovieDB.TMSError&gt;) -&gt; () in TheMovieDB.MovieDetailsViewModel.fetchMovieDetails(withID: Swift.Int) -&gt; ()"
moduleName = "TheMovieDB"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/Sani/Documents/Software/tech-work-sample/TheMovieDB/TheMovieDB/Features/Movie%20Details/MovieDetailsViewModel.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "40"
endingLineNumber = "40"
offsetFromSymbolStart = "213">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "53F2C978-C2CA-4554-B98F-F81340AC77A3"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "TheMovieDB/Networking/HTTPRequestImpl.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "66"
endingLineNumber = "66"
landmarkName = "get(from:params:returnType:completed:)"
landmarkType = "7">
<Locations>
<Location
uuid = "53F2C978-C2CA-4554-B98F-F81340AC77A3 - 7858942bde6d9669"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "TheMovieDB.HTTPRequestImpl.get&lt;&#x3c4;_0_0 where &#x3c4;_0_0: Swift.Decodable&gt;(from: Foundation.URL, params: Swift.Optional&lt;Swift.Dictionary&lt;Swift.String, Swift.String&gt;&gt;, returnType: &#x3c4;_0_0.Type, completed: (Swift.Result&lt;&#x3c4;_0_0, TheMovieDB.TMSError&gt;) -&gt; ()) -&gt; ()"
moduleName = "TheMovieDB"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/Sani/Documents/Software/tech-work-sample/TheMovieDB/TheMovieDB/Networking/HTTPRequestImpl.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "66"
endingLineNumber = "66"
offsetFromSymbolStart = "1894">
</Location>
<Location
uuid = "53F2C978-C2CA-4554-B98F-F81340AC77A3 - 86cfc81a092ebf33"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "closure #2 (Swift.Optional&lt;Foundation.Data&gt;, Swift.Optional&lt;__C.NSURLResponse&gt;, Swift.Optional&lt;Swift.Error&gt;) -&gt; () in TheMovieDB.HTTPRequestImpl.get&lt;&#x3c4;_0_0 where &#x3c4;_0_0: Swift.Decodable&gt;(from: Foundation.URL, params: Swift.Optional&lt;Swift.Dictionary&lt;Swift.String, Swift.String&gt;&gt;, returnType: &#x3c4;_0_0.Type, completed: (Swift.Result&lt;&#x3c4;_0_0, TheMovieDB.TMSError&gt;) -&gt; ()) -&gt; ()"
moduleName = "TheMovieDB"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/Sani/Documents/Software/tech-work-sample/TheMovieDB/TheMovieDB/Networking/HTTPRequestImpl.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "68"
endingLineNumber = "68"
offsetFromSymbolStart = "365">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TheMovieDB.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
36 changes: 36 additions & 0 deletions TheMovieDB/TheMovieDB/App/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// TheMovieDB
//
// Created by Ali Sani on 12/11/21.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

52 changes: 52 additions & 0 deletions TheMovieDB/TheMovieDB/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// SceneDelegate.swift
// TheMovieDB
//
// Created by Ali Sani on 12/11/21.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}

func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}

func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}

func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}

func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}

func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}


}

19 changes: 19 additions & 0 deletions TheMovieDB/TheMovieDB/App/ViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// ViewController.swift
// TheMovieDB
//
// Created by Ali Sani on 12/11/21.
//

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading