Coder Social home page Coder Social logo

movies's Introduction

Build Status

This is a simple Movie DB client for iPhones written in Swift. I use it mostly to try out new ideas and technologies.

movies's People

Contributors

zoul avatar

Stargazers

Igor Zubkov avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

movies's Issues

Improve JSON parsing

I don’t mind parsing the JSON by hand, it’s nicely explicit. What I don’t like is repeating the property names:

guard let dict = jsonObject as? NSDictionary,
    let id = dict["id"] as? Int,
    let title = dict["title"] as? String,
    let voteAverage = dict["vote_average"] as? Float,
    let backdropPath = dict["backdrop_path"] as? String,
    let overview = dict["overview"] as? String,
    let releaseDate = dict["release_date"] as? String
    else { return nil }

self.id = id
self.title = title
self.voteAverage = voteAverage
self.backdropPath = backdropPath
self.overview = overview
self.releaseDate = releaseDate

I like what Argo does:

return curry(User.init)
      <^> json <| "id"
      <*> json <| "name"
      <*> json <|? "email" // Use ? for parsing optional values
      <*> json <| "role" // Custom types that also conform to Decodable just work
      <*> json <| ["company", "name"] // Parse nested objects
      <*> json <|| "friends" // parse arrays of objects

The interesting trick is using the Curry module, see the accompanying blog post.

Interactive playgrounds for views

See this post by Kickstarter and the video linked from there. The main idea is having the option to tweak all possible state variables interactively in a playground, instead of having to navigate the live UI to get there. Also, this should enable easy screenshot testing, ie. rendering the screens for various state combinations and then checking them against known “good” screenshots.

  • Extract the UI code into a framework that can be imported into a playground
  • Patch MovieDetailController so that it can be loaded in a playground
  • Patch MovieListController so that it can be loaded in a playground
  • Add sample content that can be easily experimented with (a sample Movie, for instance)

Improve caching

Right now the caching is probably completely broken. That could be fixed by setting the right caching options when reading from the webservice, but the real goal here is to detect offline mode and set the cache behaviour accordingly (.useProtocolCachePolicy when online, .returnCacheDataDontLoad when offline?).

Improve image caching

Right now there’s always an asynchronous call with a placeholder image even if the real image is cached. It would be nice to load the cached images immediately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.