Created
May 1, 2017 19:47
-
-
Save zenangst/fdb2350189289305b1c5acc104a41691 to your computer and use it in GitHub Desktop.
From inspiration to production, Part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Spots | |
enum MainContentType: String { | |
case details, reception, related | |
} | |
class ContentFactory { | |
func sideComponents() -> [ComponentModel] { | |
let posterComponent = ComponentModel( | |
layout: Layout(span: 1, lineSpacing: 10, inset: Inset(top: 25, left: 5, right: 5)), | |
items: [ | |
Item(image: "https://upload.wikimedia.org/wikipedia/en/d/d4/Rogue_One%2C_A_Star_Wars_Story_poster.png", kind: "poster-view") | |
] | |
) | |
let buttonComponent = ComponentModel( | |
kind: .grid, | |
layout: Layout(span: 1, lineSpacing: 10, inset: Inset(top: 15, left: 25, right: 25)), | |
items: [ | |
Item(title: "IMDb", kind: "button-view"), | |
Item(title: "Rotten tomatos", kind: "button-view") | |
] | |
) | |
let releaseComponent = ComponentModel( | |
kind: .grid, | |
layout: Layout(span: 1, lineSpacing: 10, inset: Inset(top: 20, left: 25, right: 25)), | |
items: [ | |
Item(title: "RELEASE", kind: "small-title-view"), | |
Item(text: "Rogue One premiered at the Pantages Theatre in Los Angeles on December 10, 2016. The film was released in certain European countries on December 14, 2016, and was released in North America on December 16, with China getting the film on January 6, 2017.", | |
kind: "info-view") | |
] | |
) | |
let homeMediaComponent = ComponentModel( | |
kind: .grid, | |
layout: Layout(span: 1, lineSpacing: 10, inset: Inset(top: 20, left: 25, right: 25)), | |
items: [ | |
Item(title: "HOME MEDIA", kind: "small-title-view"), | |
Item(text: "Rogue One was released on Digital HD on March 24, 2017, and on Blu-ray and DVD on April 4, 2017.", kind: "info-view") | |
] | |
) | |
let sourceComponent = ComponentModel( | |
kind: .grid, | |
layout: Layout(span: 1, lineSpacing: 10, inset: Inset(top: 20, left: 25, right: 25)), | |
items: [ | |
Item( | |
title: "SOURCE", | |
kind: "small-title-view" | |
), | |
Item(text: "The content on this screen is provided by wikipedia.org", kind: "info-view") | |
] | |
) | |
return [posterComponent, buttonComponent, releaseComponent, homeMediaComponent, sourceComponent] | |
} | |
func mainComponents(type: MainContentType = .details) -> [ComponentModel] { | |
var components = createHeaderComponent(type: type) | |
switch type { | |
case .details: | |
components.append(contentsOf: createDetailsComponent()) | |
case .reception: | |
components.append(contentsOf: createReceptionComponent()) | |
case .related: | |
components.append(contentsOf: createRelatedComponent()) | |
} | |
return components | |
} | |
func createHeaderComponent(type: MainContentType = .details) -> [ComponentModel] { | |
let headerComponent = ComponentModel( | |
layout: Layout(span: 1, inset: Inset(top: 20, left: 20, right: 20)), | |
items: [Item(title: "Rouge One: A Star Wars Story", kind: "title-view") | |
] | |
) | |
let specsComponent = ComponentModel(kind: .grid, | |
layout: Layout(itemSpacing: 5.0, inset: Inset(top: 15, left: 20, bottom: 15, right: 20)), | |
items: [ | |
Item(title: "PG-13", kind: "label-view", meta: ["filled" : false]), | |
Item(title: "CC", kind: "label-view", meta: ["filled" : false]), | |
Item(title: "AD", kind: "label-view", meta: ["filled" : false]), | |
Item(title: "HD", kind: "label-view") | |
] | |
) | |
let navigationComponent = ComponentModel( | |
kind: .grid, | |
layout: Layout(itemSpacing: 5, inset: Inset(top: 0, left: 20, bottom: 25, right: 20)), | |
items: [ | |
Item(title: "Details", kind: "small-button-view", action: "\(MainContentType.details.rawValue)", meta: ["selected" : type == .details]), | |
Item(title: "Reception", kind: "small-button-view", action: "\(MainContentType.reception.rawValue)", meta: ["selected" : type == .reception]), | |
Item(title: "Related", kind: "small-button-view", action: "\(MainContentType.related.rawValue)", meta: ["selected" : type == .related]) | |
] | |
) | |
return [headerComponent, specsComponent, navigationComponent] | |
} | |
func createDetailsComponent() -> [ComponentModel] { | |
let reviewComponent = ComponentModel(header: Item(title: "Overview", kind: "header-view"), | |
kind: .grid, | |
layout: Layout(span: 1, inset: Inset(left: 20, bottom: 30, right: 20)), | |
items: [Item( | |
text: "Rogue One: A Star Wars Story, or simply Rogue One, is a 2016 American epic space opera film directed by Gareth Edwards and written by Chris Weitz and Tony Gilroy, based on a story by John Knoll and Gary Whitta. It was produced by Lucasfilm and distributed by Walt Disney Studios Motion Pictures. It is the first installment of the Star Wars Anthology series, set immediately before the events of the original Star Wars film. The cast includes Felicity Jones, Diego Luna, Riz Ahmed, Ben Mendelsohn, Donnie Yen, Mads Mikkelsen, Alan Tudyk, Jiang Wen and Forest Whitaker. Rogue One follows a group of rebels on a mission to steal the plans for the Death Star, the Galactic Empire's superweapon.", | |
kind: "info-view" | |
)] | |
) | |
let aboutComponent = ComponentModel(header: Item(title: "Plot", kind: "header-view"), | |
kind: .grid, | |
layout: Layout(span: 1, inset: Inset(left: 20, bottom: 30, right: 20)), | |
items: [Item( | |
text: "Research scientist Galen Erso and his family are in hiding on the planet Lah'mu. Imperial weapons developer Orson Krennic arrives to press him into completing the Death Star, a space station-based superweapon capable of destroying planets. Galen's wife Lyra is killed in the confrontation while their daughter Jyn escapes and is taken to safety by Rebel extremist Saw Gerrera.\n\nFifteen years later, cargo pilot Bodhi Rook defects from the Empire, smuggling a holographic message from Galen to Gerrera on the desert moon Jedha. Rebel intelligence officer Cassian Andor frees Jyn from an Imperial labor camp at Wobani before bringing her to the Rebel leader Mon Mothma, who convinces her to find and rescue Galen so the Alliance can learn more about the Death Star. Cassian is covertly ordered by General Draven, an Alliance military officer, to kill Galen rather than extract him.", | |
kind: "info-view" | |
)] | |
) | |
let trailersComponent = ComponentModel( | |
identifier: "Trailers component", | |
header: Item(title: "Trailers", kind: "header-view"), | |
kind: .carousel, | |
layout: Layout(itemSpacing: 10.0, inset: Inset(top: 20, left: 20, bottom: 20, right: 20)), | |
items: [ | |
Item(title: "Trailer 1", image: "Trailer1", kind: "trailer-view"), | |
Item(title: "Trailer 2", image: "Trailer2", kind: "trailer-view"), | |
Item(title: "Trailer 3", image: "Trailer3", kind: "trailer-view"), | |
Item(title: "Trailer 4", image: "Trailer4", kind: "trailer-view"), | |
Item(title: "Trailer 5", image: "Trailer5", kind: "trailer-view"), | |
Item(title: "Trailer 6", image: "Trailer6", kind: "trailer-view"), | |
], | |
meta: ["gray-background" : true] | |
) | |
let actorsComponent = ComponentModel( | |
header: Item(title: "Actors", kind: "header-view"), | |
layout: Layout(span: 3, inset: Inset(top: 20, left: 20, bottom: 20, right: 20)), | |
items: [ | |
Item(title: "Felicity Jones", subtitle: "Jyn Erso", image: "https://images-na.ssl-images-amazon.com/images/M/MV5BMjA0MTIwMzIyN15BMl5BanBnXkFtZTgwNDEyMzg1NDE@._V1_UX214_CR0,0,214,317_AL_.jpg", kind: "actor-view"), | |
Item(title: "Diego Luna", subtitle: "Cassian Andor", image: "https://images-na.ssl-images-amazon.com/images/M/MV5BOTE0MjI2NDczMl5BMl5BanBnXkFtZTcwMTgwMDgyMg@@._V1_UY317_CR2,0,214,317_AL_.jpg", kind: "actor-view"), | |
Item(title: "Alan Tudyk", subtitle: "K-2SO", image: "https://images-na.ssl-images-amazon.com/images/M/MV5BMjE0MzEwNDUxNV5BMl5BanBnXkFtZTcwNTE1MDAzOQ@@._V1_UY317_CR2,0,214,317_AL_.jpg", kind: "actor-view"), | |
Item(title: "Donnie Yen", subtitle: "Chirrut Îmwe", image: "https://images-na.ssl-images-amazon.com/images/M/MV5BMTQ3MzA0MDk0M15BMl5BanBnXkFtZTcwMTc2MjM1OQ@@._V1_UX214_CR0,0,214,317_AL_.jpg", kind: "actor-view"), | |
Item(title: "Wen Jiang", subtitle: "Baze Malbus", image: "https://images-na.ssl-images-amazon.com/images/M/MV5BMTY2NTUyODA1N15BMl5BanBnXkFtZTgwODIzOTQ0OTE@._V1_UY317_CR5,0,214,317_AL_.jpg", kind: "actor-view"), | |
Item(title: "Ben Mendelsohn", subtitle: "Orson Krennic", image: "https://images-na.ssl-images-amazon.com/images/M/MV5BMjA3NzcyMDcyMF5BMl5BanBnXkFtZTcwNjQwMTczMQ@@._V1_UY317_CR4,0,214,317_AL_.jpg", kind: "actor-view"), | |
] | |
) | |
return [ | |
reviewComponent, | |
aboutComponent, | |
trailersComponent, | |
actorsComponent | |
] | |
} | |
func createReceptionComponent() -> [ComponentModel] { | |
let boxOfficeComponent = ComponentModel(header: Item(title: "Box office", kind: "header-view"), | |
kind: .grid, | |
layout: Layout(span: 1, inset: Inset(left: 20, bottom: 30, right: 20)), | |
items: [Item( | |
text: "As of April 30, 2017, Rogue One has grossed $532.2 million in the United States and Canada and $523.8 million in other countries for a worldwide total of $1.056 billion.[1] On January 21, 2017, the film became Disney's fourth of 2016 to earn $1 billion in ticket sales, joining Captain America: Civil War, Zootopia and Finding Dory.[129] It is the second highest-grossing film of 2016, the second highest-grossing Star Wars film, and the 22nd highest-grossing film of all time, all unadjusted for inflation. It is also the third Star Wars film to gross over $1 billion worldwide, following The Phantom Menace and The Force Awakens. In the United States, it was the top-grossing film of 2016.[130][131] Deadline.com calculated the net profit of the film to be $319.6 million, when factoring together all expenses and revenues for the film, making it the 3rd most profitable release of 2016.[132]\n\nIn late November 2016, box office projections for the United States and Canada had the film grossing $100–150 million during its opening weekend.[133][134] Disney chairman Bob Iger noted that Disney and Lucasfilm did not expect Rogue One to match The Force Awakens' total gross of $2.1 billion, nor its $248 million opening.[135] Pre-sale tickets for the film went on sale at 12:01 AM EST on November 28, 2016. Within 10 minutes, ticket sale sites such as Fandango crashed, much like The Force Awakens had the year prior.[136] In its first 24 hours, the film had the second-highest amount of pre-sale tickets ever sold, behind only The Force Awakens.[137] Worldwide, the film was expected to gross $280–350 million in its opening weekend.[138]\n\nIn the United States, the film made $29 million from its Thursday night previews, making it the highest grossing Thursday opening of 2016. On Friday, the film earned $71.1 million, earning the 12th highest grossing opening day of all-time. The film grossed $46.3 million on Saturday, securing a total of $155.1 million in its opening weekend, the third biggest debut of 2016.[138] It topped the box office once again in its second weekend, grossing $64 million (down 58.7%) over the three day weekend, and $96.1 million over the four day weekend. On Christmas Day, it grossed $25.9 million.[139] It finished first at the box office again in its third weekend, grossing $49.6 million (-22.5%) over the three day weekend and $65.5 million over the four day weekend, becoming the seventh film of 2016 to top the box office three times, following Deadpool, Zootopia, The Jungle Book, Finding Dory, Suicide Squad, and Moana.[140] In its fourth weekend, Sunday projections had the film grossing $22 million, besting newcomer Hidden Figures' $21.8 million. However, final figures the following day revealed the film tallied a weekend total of $21.9 million, falling to second place behind Hidden Figures's $22.8 million.[141]", | |
kind: "info-view" | |
)]) | |
let criticalResponseComponent = ComponentModel(header: Item(title: "Critical response", kind: "header-view"), | |
kind: .grid, | |
layout: Layout(span: 1, inset: Inset(left: 20, bottom: 30, right: 20)), | |
items: [Item( | |
text: "Rogue One received generally positive reviews from critics. On Rotten Tomatoes the film has an approval rating of 85% based on 340 reviews with an average rating of 7.5/10. The site's critical consensus reads, \"Rogue One draws deep on Star Wars mythology while breaking new narrative and aesthetic ground -- and suggesting a bright blockbuster future for the franchise.\"[142] On Metacritic, the film has a score 65 out of 100 based on 51 critics, indicating \"generally favorable reviews\".[143] Audiences polled by CinemaScore gave the film an average grade of \"A\" on an A+ to F scale.[144]\n\n IGN reviewer Eric Goldman gave the film 9/10, saying, \"Rogue One is a movie crammed with fan service, but when fan service is done this well, there's little to complain about and much to adore.\"[145] Peter Travers of Rolling Stone gave the film 3.5 out of 4 stars, writing, \"this spin-off/prequel has the same primitive, lived-in, emotional, loopy, let's-put-on-a-show spirit that made us fall in love with the original trilogy.\"[146] /Film gave Rogue One 8/10, writing that the film is enjoyable but does not have the emotional weight of The Force Awakens, because \"no character in Rogue One was strongly compelling\".[147] PopMatters wrote, \"Rogue One seems to enjoy spending time on a whole new batch of moons and planets we haven't seen before, reveling in the clutter and clamor of far-flung settlements where anti-Imperial sentiments fester. But the film is bogged down in engineering the complex maneuverings of spy games, dogfights, and the most sprawling Rebel-versus-Empire land battle scene since the opening of The Empire Strikes Back.\"[148] Justin Chang, writing for the Los Angeles Times, called Rogue One \"a swiftly paced, rough-and-ready entertainment.\"[149]\n\nThe New York Times wrote, \"All the pieces are there, in other words, like Lego figures in a box. The problem is that the filmmakers haven't really bothered to think of anything very interesting to do with them. A couple of 9-year-olds on a screen-free rainy afternoon would come up with better adventures, and probably also better dialogue.\"[150] Richard Brody of The New Yorker called the film \"lobotomized and \"depersonalized\", and wrote it \"isn't so much a movie as a feature-length promotional film for itself; it's a movie that is still waiting to be made.\"[151] The Washington Post wrote \"Rogue One represents an unobjectionable exercise in franchise extension. It's fine. It'll do. For now.\"[152]\n\nIndieWire's David Ehrlich gave the film a C+ rating, calling it \"a spirited but agonizingly safe attempt to expand cinema's most holy blockbuster franchise and keep the wheels greased between proper installments […] just a glorified excuse to retcon some sense into one of the silliest things about the original.\" While he praised the set design and visuals, calling them \"gorgeous\", he criticized a lack of interesting character development and a script that felt \"completely constricted by its purpose.\"[153]\n\nPeter Bradshaw, film critic of The Guardian says \"Rogue One doesn't really go rogue at any stage, and it isn't a pop culture event like The Force Awakens, in whose slipstream this appears; part of its charm resides in the eerie, almost dreamlike effect of continually producing familiar elements, reshuffled and reconfigured, a reaching back to the past and hinting at a preordained future. There are some truly spectacular cameos from much-loved personae, involving next-level digital effects — almost creepily exact, so that watching feels at various stages like going into a time machine, back to the 80s and 70s\".[154]", | |
kind: "info-view" | |
)]) | |
return [boxOfficeComponent, criticalResponseComponent] | |
} | |
func createRelatedComponent() -> [ComponentModel] { | |
let infoComponent = ComponentModel( | |
header: Item(title: "Star Wars films and television series", kind: "header-view"), | |
layout: Layout(span: 1, inset: Inset(top: 0, left: 20, bottom: 40, right: 20)), | |
items: [Item(text: "The Star Wars films include two complete trilogies: the original trilogy released between 1977 and 1983, and the prequel trilogy released between 1999 and 2005. A third trilogy that follows the first two began in 2015. Other films have taken or will take place between the trilogy films. There have also been several Star Wars television series and television movies, with the first being released in 1978.", kind: "info-view")] | |
) | |
let relatedComponent = ComponentModel( | |
header: Item(title: "Related movies", kind: "header-view"), | |
kind: .carousel, | |
layout: Layout(itemSpacing: 10, inset: Inset(top: 20, left: 20, bottom: 20, right: 20)), | |
items: [ | |
Item(title: "Star Wars: The Force Awakens", image: "https://upload.wikimedia.org/wikipedia/en/a/a2/Star_Wars_The_Force_Awakens_Theatrical_Poster.jpg", kind: "movie-view"), | |
Item(title: "Star Wars: The Empire Strikes Back", image: "https://upload.wikimedia.org/wikipedia/en/3/3c/SW_-_Empire_Strikes_Back.jpg", kind: "movie-view"), | |
Item(title: "Star Wars: A New Hope", image: "https://upload.wikimedia.org/wikipedia/en/8/87/StarWarsMoviePoster1977.jpg", kind: "movie-view"), | |
Item(title: "Star Wars: The Phantom Menace", image: "https://upload.wikimedia.org/wikipedia/en/4/40/Star_Wars_Phantom_Menace_poster.jpg", kind: "movie-view"), | |
Item(title: "Star Wars: Return of the Jedi", image: "https://upload.wikimedia.org/wikipedia/en/b/b2/ReturnOfTheJediPoster1983.jpg", kind: "movie-view"), | |
Item(title: "Star Wars: Revenge of the Sith", image: "https://upload.wikimedia.org/wikipedia/en/9/93/Star_Wars_Episode_III_Revenge_of_the_Sith_poster.jpg", kind: "movie-view"), | |
Item(title: "Star Wars: Attack of the Clones", image: "https://upload.wikimedia.org/wikipedia/en/3/32/Star_Wars_-_Episode_II_Attack_of_the_Clones_%28movie_poster%29.jpg", kind: "movie-view"), | |
], | |
meta: ["gray-background" : true] | |
) | |
let sameActorsComponent = ComponentModel( | |
header: Item(title: "Movies by These actors", kind: "header-view"), | |
kind: .carousel, | |
layout: Layout(itemSpacing: 10, inset: Inset(top: 20, left: 20, bottom: 20, right: 20)), | |
items: [ | |
Item(title: "Star Wars: Revenge of the Sith", image: "https://upload.wikimedia.org/wikipedia/en/9/93/Star_Wars_Episode_III_Revenge_of_the_Sith_poster.jpg", kind: "movie-view"), | |
Item(title: "Big Hero 6", image: "https://upload.wikimedia.org/wikipedia/en/4/4b/Big_Hero_6_%28film%29_poster.jpg", kind: "movie-view"), | |
Item(title: "Contraband", image: "https://upload.wikimedia.org/wikipedia/en/a/ac/Contraband2012Poster.jpg", kind: "movie-view"), | |
Item(title: "Frozen", image: "https://upload.wikimedia.org/wikipedia/en/0/05/Frozen_%282013_film%29_poster.jpg", kind: "movie-view"), | |
] | |
) | |
return [infoComponent, relatedComponent, sameActorsComponent] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment