Sytac iOS assignment | Movies|

Related tags

Testing Sytac-Test
Overview

Sytac

Sytac iOS assignment | Movies

The time has come for us to unveil the code challenge Sytac has prepared for you. The challenge involves working with the Movies application and includes the following tasks:

Questions

  1. Provide a high-level review of the application. Give your opinion on both aspects you consider positive and aspects you consider negative. Describe how and why would you do things differently. 

  2. The logic of ImageCache hides an issue. Try to discover and fix it.
  3. Replace the binding between Repository and View model without combine.
  4. Replace the Popular detail view with a new custom detail view. This view should display a detail with the info of the model movie model. Please use SwiftUI for the detailed view.
  5. Replace the TopRated tab with a new list view. This view should display a list of the TopRated movies and it must be implemented programmatically using UIKit.
  6. Write unit tests whereever you need them.
  7. In MoviewRow.swift line 11 we use @StateObject, could we change it with @ObservableObject? what are the differences?
  8. In PopularMoviesListViewModel.swift we ask for popular movies, using the current implementation fetch top rated movies instead, and explain what is happening.
  9. Implement load more functionality for Popular movies list screen.

You have total freedom to modify the codebase, there are no constraints on the design/layout of the TopRated screen. The TopRated List and detail view should be created programmatically only (no Interface Builder nor SwiftUI).

Notes: The Movies project works with Xcode 12 and up and the language used is Swift.

Backend:

To retrieve movies related data, the application is using this API https://www.themoviedb.org/documentation/api

Requisites:

  • The project has to compile without errors.
  • The code should be clean, efficient and understandable. Remember to structure your source code correctly (using a nice architecture would make this easier).
  • Keep in mind the performance of the application.
  • Use version control in the project to show your progress, commit like you would normally.
  • We would like to see at least the first 5 questions solved, the more you provide the better.

Good luck!

License

MIT Free Software!

Paulo's Test

Architecture

The app uses MVVM architecture to define its separation of concerns. SwiftUI and Combine are used to bind UI elements and interactions in the popular tab. In overall classes are small and encapsulated, which make the app scalable. For dependency management, Swift Package Manager is the tool of choice.

As for suggestions:

  1. Include a new protocol for viewModel that will define Input and Output objects, which make communication between view and viewModel clearer.
  2. Change the way view communicates with viewModel, for example line 32 on MoviewRow, .onAppear(perform: { movie.fetchImage() }). A view should not initialize a function inside viewModel but instead inform that an action was performed, e.g: .onAppear(perform: { movie.input.onAppear() }). In the future if a viewModel needs to be updated or add more functionalities to a specific action, the view does not need to change, instead just reflect the viewModel state.
  3. Some classes have difficult or unclear naming, e.g: MovieAdaptor, PopularMovie; Unless you open the class and read it, you won’t know what they do so I would suggest adding a few prefixes/suffixes to these files PopularMovieAdapter PopularMovieViewModel`
  4. Folder structure could be improved by adding a few layers for each feature, e.g: View/Popular/Row; Bundling model, viewModel and view in the same folder for a specific feature.

ImageCache Logic

Problem: 
Images not loading when multiple requests are from the same URL 
How to reproduce:
Add in line 32 this code let newUrl = NSURL(string: "https://image.tmdb.org/t/p/w500/jKuDyqx7jrjiR9cDzB5pxzhJAdv.jpg”)! Replace all url variable uses to newUrl, no images will load until you scroll the tableView and cells start requesting from cache instead of needing download.

Fix 1 (Not good but quick): Line 42 and 67 have a return to stop the function. Line 42 avoids same url requests to be executed in succession. Line 67 avoids blocks of the same url to be called, preventing updates to UI.

Commenting both lines, will provide a quick fix to give us time for a proper investigation if issue is critical and needs redeployment. But it may cost more bandwidth and phone memory by updating the views many times.

Fix 2 (Better):

  1. Add more control flows to NSCache with lock
  2. Make use of Quality of Service = Utility on our NSThread to provide a better performance.
  3. Perhaps use Core Data to provide a longer term Cache for users

Replace binding Repository and View model without combine

I’ve added a class called Binder which uses a technique called Boxing, making it easy to drop in and does not require complex changes to the project such as adding RxSwift.

Replace Popular Detail

I’ve added a new design for the detail page, including more data then the popular list.

Replace TopRated Tab

I’ve added a new design for the list page, using entirely UIKit.

Unit Tests

No tests added

MovieRow @StateObject vs @ObservableObject

Yes, in this case it is possible to change @StateObject to @ObservableObject. The main reason is that MoviewRow does not own the instance of PopularMovie and needs to only observe the object. A good class to understand their differences are in this class from WWDC: https://developer.apple.com/videos/play/wwdc2020/10040/

Fetch Top Rated

To enable Top Rated fetching, we can switch line 25 of PopularMoviesListViewModel.swift from moviesRepo.getPopular() to moviesRepo.getTopRated(). This function will instantiate TopRatedMoviesService instead of PopularMoviesService, this means we will call a different API, on a different path compared to PopularMoviesService, resulting in a a different service response, in this case, IMDB’s Top Rated movies.

Load More for popular movies

Not provided.

You might also like...
Simple BDD for iOS

Kiwi: Simple BDD for iOS Kiwi is a Behavior Driven Development library for iOS development. The goal is to provide a BDD library that is exquisitely s

A Mac and iOS Playgrounds Unit Testing library based on Nimble.
A Mac and iOS Playgrounds Unit Testing library based on Nimble.

Spry Spry is a Swift Playgrounds Unit Testing library based on Nimble. The best thing about Spry is that the API matches Nimble perfectly. Which means

Multivariate & A/B Testing for iOS and Mac

This library is no longer being maintained. You can continue to use SkyLab in your projects, but we recommend switching another solution whenever you

Remote configuration and A/B Testing framework for iOS

MSActiveConfig v1.0.1 Remote configuration and A/B Testing framework for iOS. Documentation available online. MSActiveConfig at a glance One of the bi

AB testing framework for iOS

ABKit Split Testing for Swift. ABKit is a library for implementing a simple Split Test that: Doesn't require an HTTP client written in Pure Swift Inst

Keep It Functional - An iOS Functional Testing Framework
Keep It Functional - An iOS Functional Testing Framework

IMPORTANT! Even though KIF is used to test your UI, you need to add it to your Unit Test target, not your UI Test target. The magic of KIF is that it

An understated approach to iOS integration testing.
An understated approach to iOS integration testing.

Subliminal is a framework for writing iOS integration tests. Subliminal provides a familiar OCUnit/XCTest-like interface to Apple's UIAutomation frame

iOS UI Automation Test Framework

Deprecation: EarlGrey 1.0 is deprecated in favor of EarlGrey 2.0 which integrates it with XCUITest. Please look at the earlgrey2 branch. EarlGrey 1.0

Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine
Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine

Bluepill is a tool to run iOS tests in parallel using multiple simulators. Motivation LinkedIn created Bluepill to run its large iOS test suite in a r

Owner
Paulo Eduardo Correa
Paulo Eduardo Correa
PinpointKit is an open-source iOS library in Swift that lets your testers and users send feedback with annotated screenshots using a simple gesture.

PinpointKit is an open-source iOS library in Swift that lets your testers and users send feedback with annotated screenshots using a simple gesture. F

Lickability 1.1k Jan 6, 2023
Snapshot testing tool for iOS and tvOS

SnapshotTest is a simple view testing tool written completely in Swift to aid with development for Apple platforms. It's like unit testing for views.

Pär Strindevall 44 Sep 29, 2022
ShortWebCore - This iOS library lets you run automations on Web Views.

This iOS library lets you run automations on Web Views. Example (Optional) Declare class conforming to AutomationRunnerDelegate: import S

Emma Cold 19 Dec 26, 2022
Implementing and testing In-App Purchases with StoreKit2 in Xcode 13, Swift 5.5 and iOS 15.

StoreHelper Demo Implementing and testing In-App Purchases with StoreKit2 in Xcode 13, Swift 5.5, iOS 15. See also In-App Purchases with Xcode 12 and

Russell Archer 192 Dec 17, 2022
Swift Package with examples of how to tests iOS apps

GimmeTheCodeTDD A swift package with examples of unit tests in iOS development. Requirements Xcode 13 Content Dependency Injection Constructor Injecti

Dominik Hauser 8 Oct 11, 2021
Library for unifying the approach to network mocking in iOS unit- & UI-tests.

TinkoffMockStrapping Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installati

Online financial ecosystem 22 Jan 3, 2023
test ios UnitTest and UITest

github_actions Bundlerの導入 fastlaneやiOSパッケージマネージャであるCocoaPodsはRubyのライブラリ 開発チームで使用するバージョンを揃えるためにBundlerを導入する bundlerのインストール gem install bundler Gemfile

SUGY 0 Nov 3, 2021
Fizz Buzz stub for interviewing iOS candidates

FizzBuzz Write a program that accepts an integer >=1 and returns a list of strings For numbers divisible by 3, return “Fizz” For numbers divisible by

Noel Stieglitz 0 Nov 3, 2021
iOS Test Hasitha

Welcome to the Bidone iOS Coding Test! iOS Create a simple application with the list of orders from viewModel and display them in a list. When a user

null 0 Nov 12, 2021
iOS Test for Openbank by David Moreno Lora

MarvelMobileTest-iOS iOS Test for Openbank by David Moreno Lora Installation Clone the project and install the dependencies using pod install Once th

David Moreno Lora 0 Nov 16, 2021