Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zenangst/1d1951034d813e2e800bb38d8e83b8de to your computer and use it in GitHub Desktop.
Save zenangst/1d1951034d813e2e800bb38d8e83b8de to your computer and use it in GitHub Desktop.
From inspiration to production, Part 2 - Example 1
private func createRelatedComponents() -> [ComponentModel] {
let infoComponent = ComponentModel(
header: Item(title: "Star Wars films and television series", kind: Spots.Identifier.header),
kind: .grid,
layout: Layout(span: 1, inset: Inset(top: 0, left: 20, bottom: 30, 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: Spots.Identifier.info)]
)
let relatedComponent = ComponentModel(
header: Item(title: "Related movies", kind: Spots.Identifier.header),
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: Spots.Identifier.movie),
Item(title: "Star Wars: The Empire Strikes Back", image: "https://upload.wikimedia.org/wikipedia/en/3/3c/SW_-_Empire_Strikes_Back.jpg", kind: Spots.Identifier.movie),
Item(title: "Star Wars: A New Hope", image: "https://upload.wikimedia.org/wikipedia/en/8/87/StarWarsMoviePoster1977.jpg", kind: Spots.Identifier.movie),
Item(title: "Star Wars: The Phantom Menace", image: "https://upload.wikimedia.org/wikipedia/en/4/40/Star_Wars_Phantom_Menace_poster.jpg", kind: Spots.Identifier.movie),
Item(title: "Star Wars: Return of the Jedi", image: "https://upload.wikimedia.org/wikipedia/en/b/b2/ReturnOfTheJediPoster1983.jpg", kind: Spots.Identifier.movie),
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: Spots.Identifier.movie),
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: Spots.Identifier.movie),
],
style: Spots.Styles.grayBackground
)
let sameActorsComponent = ComponentModel(
header: Item(title: "Movies by These actors", kind: Spots.Identifier.header),
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: Spots.Identifier.movie),
Item(title: "Big Hero 6", image: "https://upload.wikimedia.org/wikipedia/en/4/4b/Big_Hero_6_%28film%29_poster.jpg", kind: Spots.Identifier.movie),
Item(title: "Contraband", image: "https://upload.wikimedia.org/wikipedia/en/a/ac/Contraband2012Poster.jpg", kind: Spots.Identifier.movie),
Item(title: "Frozen", image: "https://upload.wikimedia.org/wikipedia/en/0/05/Frozen_%282013_film%29_poster.jpg", kind: Spots.Identifier.movie),
]
)
return [infoComponent, relatedComponent, sameActorsComponent]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment