Much a-do with compositional layouts and diffable data sources.

Overview

Film

Goal

  • Reflect upon decisions made on my last project Films (submitted in July of 2019) and make improvements on my findings.
  • Be more pragmatic with my approach to solving problems in code.
  • Spend less than 24 hours designing and implementing (18 hours spent in total).

Reflective findings when revisiting the previous project

  • It was an overly complicated project which made the codebase extremely hard to navigate.
  • The networking logic would make redundant calls whenever a cell came into view as there was no caching logic for OMDB calls.
  • The procedural image loading on the cell was buggy due to improper delegate management.
  • The nesting of collection views within table view cells was extremely heavy and resulted in good, but not great, scroll performance.

Improvements made over previous project

  • Reduced lines of code from 3622 to 1556 (57% decrease).
    • Project migrated from using Storyboard to now being purely programmatic.
    • Adjusting for autolayout, setup, and styling code which was previously managed in Storyboards (250 lines), the number of lines is further reduced to 1306 (65% decrease).
    • $ find . \( -iname \*.swift \) -exec wc -l '{}' \+
  • Sorting logic has been replaced with a dynamic debounced search query which has a custom cache backing to avoid redundant filters.
  • Cell dequeuing previously caused issues by not retaining scroll position offset which have since been fixed.
  • The detail screen is more informative and slightly cleaner.
  • Declared subdomains for HTTP payloads on the nflx and omdb endpoints as to not expose all traffic through the application.
  • By utilizing systemColors, this new application supports both light and dark modes.

Cool discoveries

  • UICollectionViewCompositionalLayout is awesome. I decided to take a swing at using this new API as it aligned nicely with the requirements with Discover screen design.
    • It only took 13 lines of code to implement the layout for the collection view. Yes, really.
  • UICollectionViewDiffableDataSource is another awesome addition to the SDK.
    • Snapshots avoid index out of bound errors and eliminate the need for data source lookups (typically).
    • Out of the box diffing...sign me up! Diffable data source is definitely a keeper.

Discussion

  • MVVM design pattern utilized as VIPER became a bit overkill with an application of this size.
  • In-memory cache utilized at the service level to avoid reconstructing custom objects.
  • Cache used to store searches to avoid re-indexing the entire response for duplicate queries.

Potential improvements

  • Offline mode - Core Data could have been utilized to persist data to the disk; however, due to time constraints I ended up not implementing this logic.
  • Better logging - A custom logger could have aided in identifying erroneous behaviors; however, considering the time frame I felt if was better if I omitted it.
  • Error handling - Error handling is crucial to a great application; however, it is often the bulk of the development effort.
    • Errors in this project were handled by placeholders and fake data.
You might also like...
Demonstrating the use of a Sidebar, SplitView and Navigation styles in a multiplatform app.
Demonstrating the use of a Sidebar, SplitView and Navigation styles in a multiplatform app.

Demonstrate the use of a Sidebar, SplitView, TabView and Navigation styles in a multiplatform app.

A simple iOS app with one default and four custom transitions.
A simple iOS app with one default and four custom transitions.

A simple iOS app with one default and four custom transitions. The app uses the same two view controllers for every transition.

OMDburner is a free and Open Source Application developed using Swift.
OMDburner is a free and Open Source Application developed using Swift.

OMDburner is a free and Open Source Application developed using Swift.

A demo project using VIPER architecture and building user interface programmatically
A demo project using VIPER architecture and building user interface programmatically

ProductDiscovery A demo project that building a UIKit user interface programmatically. Because the UI is made of code very long so I have separated it

 MeCab Demo for iOS 15 and SPM
MeCab Demo for iOS 15 and SPM

MeCab Demo for iOS 15 and SPM Sample project for MeCab, a Japanese tokenizer/morphological analyzer. Updated for iOS 15 and SPM. Successor to landonep

Instagram Clone Application Built Using Swift And Firebase
Instagram Clone Application Built Using Swift And Firebase

InstagramClone Bu instagram klon uygulamasında CoreLocation, Snapkit, Firebase, KingFisher, IQKeyboardManagerSwift kütüphaneleri kullanılmıştır. Kulla

Weather Forecast Assigment is an iOS application built to highlight MVP and Clean Architecture concepts

Weather Forecast Assigment - iOS - MVP + Clean Architecture Description Weather Forecast Assigment is an iOS application built to highlight MVP (Model

A simple app that downloads a list of albums from iTunes and displays it in a table

A simple, sample app that downloads a list of albums from iTunes and displays it in a table. It also allows the user to bookmark albums which are then

Owner
Christian Ampe
iOS Engineer
Christian Ampe
iOS app for the Valorant lineups, agents, crosshairs and much more

Valorant-Helper iOS app for the Valorant lineups, agents, crosshairs and much more(coming soon!) Agents FLOW On the first page there are agents and yo

Zuka 4 Sep 20, 2022
Task App for Swift that Persist Data with Core Data (iOS)

Originally by: Michael Crump Updates for Xcode 10 with Swift 4.2 by David Phillip Oster

Michael Crump 16 Aug 3, 2021
Concept for organizing View and Data layers within SwiftUI App

SwiftUI MVVM Concept It is not about how to create Lists and Charts and View design. It's about possibility how to organize View and Data layers withi

Igor 16 May 16, 2022
iOS Application that gets the trending repositories data from Github API and displays it in a tableView.

Github-Trending-Repos iOS Application that gets the trending repositories data from Github API and displays it in a tableView. Follows MVC architectur

Anshul Koshyari 0 Oct 30, 2021
Code Challenge - Using Alamofire is a Swift-based, HTTP networking library, also Codable for Data Model and Combine Framework .

Code Challenge ##Using Alamofire is a Swift-based, HTTP networking library, also Codable for Data Model and Combine Framework . Alamofire is one of th

Eng Angelo Saber 0 Nov 24, 2021
Example Xcode swift iOS project for Core Data + iCloud syncing

iCloudCoreDataStarter Hello, I'm Chad. For the last several months I have been working on Sticker Doodle, an app you should go download right now! In

Chad Etzel 521 Dec 27, 2022
🎉 WWDC 2021 Swift Student Challenge Winner 🎉 Dance Party allows users to record choreography and play against other users to try and match the key poses!

?? Dance Party ?? ?? WWDC 2021 Swift Student Challenge Winner ?? Installation Steps (Works on iPad Only) Clone or Download Unzip the .playgroundbook.z

Alan Yan 7 Oct 17, 2022
MemeMe, students will create an app that enables a user to take a picture, and add text at the top and bottom to form a meme

With this first version of MemeMe, students will create an app that enables a user to take a picture, and add text at the top and bottom to form a meme. The user will be able to share the photo on Facebook and Twitter and also by SMS or email.

Marcos 0 Dec 11, 2021
A clone of the Twitter app that allows users to log in and read, create, and interact with tweets

A clone of the Twitter app that allows users to log in and read, create, and interact with tweets

Sakib Ahmed 1 Mar 12, 2022