Skip to content

Commit

Permalink
Component 6 - Movie Details Screen UI
Browse files Browse the repository at this point in the history
  • Loading branch information
sshikalgar committed Aug 5, 2020
1 parent 7af932a commit cfcb7b3
Show file tree
Hide file tree
Showing 21 changed files with 1,074 additions and 3 deletions.
108 changes: 108 additions & 0 deletions SwiftUILearning.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
386B8C2424C717DD00162409 /* SegmentControllerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 386B8C2324C717DD00162409 /* SegmentControllerViewModel.swift */; };
386B8C2724C718C400162409 /* SegmentControllerListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 386B8C2624C718C400162409 /* SegmentControllerListView.swift */; };
386B8C2924C718D100162409 /* SegmentControllerScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 386B8C2824C718D100162409 /* SegmentControllerScrollView.swift */; };
387FF9C224D7F02B001BF8E3 /* MovieDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9C124D7F02B001BF8E3 /* MovieDetailModel.swift */; };
387FF9C424D7F036001BF8E3 /* MovieDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9C324D7F036001BF8E3 /* MovieDetailView.swift */; };
387FF9C624D7F043001BF8E3 /* MovieDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9C524D7F043001BF8E3 /* MovieDetailViewModel.swift */; };
387FF9C924D7F678001BF8E3 /* TagScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9C824D7F678001BF8E3 /* TagScrollView.swift */; };
387FF9CB24D7F99D001BF8E3 /* MovieDetailImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9CA24D7F99D001BF8E3 /* MovieDetailImageView.swift */; };
387FF9CD24D7F9E0001BF8E3 /* CornerRadiusViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9CC24D7F9E0001BF8E3 /* CornerRadiusViewModifier.swift */; };
387FF9CF24D7FEB4001BF8E3 /* MovieRatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9CE24D7FEB4001BF8E3 /* MovieRatingView.swift */; };
387FF9D124D80958001BF8E3 /* ImageAndRatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9D024D80958001BF8E3 /* ImageAndRatingView.swift */; };
387FF9D324D81486001BF8E3 /* MovieSubDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9D224D81486001BF8E3 /* MovieSubDetailView.swift */; };
387FF9D524D81B50001BF8E3 /* MovieDetailDescriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9D424D81B50001BF8E3 /* MovieDetailDescriptionView.swift */; };
387FF9D724D829D4001BF8E3 /* CrewAndCastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9D624D829D4001BF8E3 /* CrewAndCastView.swift */; };
387FF9DA24D85193001BF8E3 /* AsyncImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9D924D85193001BF8E3 /* AsyncImage.swift */; };
387FF9DC24D851AC001BF8E3 /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9DB24D851AC001BF8E3 /* ImageCache.swift */; };
387FF9DE24D851CB001BF8E3 /* ImageLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9DD24D851CB001BF8E3 /* ImageLoader.swift */; };
387FF9E024D851E5001BF8E3 /* EnvironmentValues+ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387FF9DF24D851E5001BF8E3 /* EnvironmentValues+ImageCache.swift */; };
388B9B1C24CFFA2900E97320 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 388B9B1B24CFFA2900E97320 /* LoginView.swift */; };
388B9B2A24D019D400E97320 /* Roboto-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 388B9B1E24D019D200E97320 /* Roboto-Light.ttf */; };
388B9B2B24D019D400E97320 /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 388B9B1F24D019D200E97320 /* Roboto-Thin.ttf */; };
Expand Down Expand Up @@ -95,6 +110,21 @@
386B8C2324C717DD00162409 /* SegmentControllerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentControllerViewModel.swift; sourceTree = "<group>"; };
386B8C2624C718C400162409 /* SegmentControllerListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentControllerListView.swift; sourceTree = "<group>"; };
386B8C2824C718D100162409 /* SegmentControllerScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentControllerScrollView.swift; sourceTree = "<group>"; };
387FF9C124D7F02B001BF8E3 /* MovieDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieDetailModel.swift; sourceTree = "<group>"; };
387FF9C324D7F036001BF8E3 /* MovieDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieDetailView.swift; sourceTree = "<group>"; };
387FF9C524D7F043001BF8E3 /* MovieDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieDetailViewModel.swift; sourceTree = "<group>"; };
387FF9C824D7F678001BF8E3 /* TagScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagScrollView.swift; sourceTree = "<group>"; };
387FF9CA24D7F99D001BF8E3 /* MovieDetailImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieDetailImageView.swift; sourceTree = "<group>"; };
387FF9CC24D7F9E0001BF8E3 /* CornerRadiusViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerRadiusViewModifier.swift; sourceTree = "<group>"; };
387FF9CE24D7FEB4001BF8E3 /* MovieRatingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieRatingView.swift; sourceTree = "<group>"; };
387FF9D024D80958001BF8E3 /* ImageAndRatingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageAndRatingView.swift; sourceTree = "<group>"; };
387FF9D224D81486001BF8E3 /* MovieSubDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieSubDetailView.swift; sourceTree = "<group>"; };
387FF9D424D81B50001BF8E3 /* MovieDetailDescriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieDetailDescriptionView.swift; sourceTree = "<group>"; };
387FF9D624D829D4001BF8E3 /* CrewAndCastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrewAndCastView.swift; sourceTree = "<group>"; };
387FF9D924D85193001BF8E3 /* AsyncImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncImage.swift; sourceTree = "<group>"; };
387FF9DB24D851AC001BF8E3 /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
387FF9DD24D851CB001BF8E3 /* ImageLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageLoader.swift; sourceTree = "<group>"; };
387FF9DF24D851E5001BF8E3 /* EnvironmentValues+ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EnvironmentValues+ImageCache.swift"; sourceTree = "<group>"; };
388B9B1B24CFFA2900E97320 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
388B9B1E24D019D200E97320 /* Roboto-Light.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Light.ttf"; sourceTree = "<group>"; };
388B9B1F24D019D200E97320 /* Roboto-Thin.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Thin.ttf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -266,6 +296,66 @@
path = SubViews;
sourceTree = "<group>";
};
387FF9BD24D7EFAC001BF8E3 /* MovieAppUI - Week 6 */ = {
isa = PBXGroup;
children = (
387FF9C024D7EFF0001BF8E3 /* Model */,
387FF9BF24D7EFEB001BF8E3 /* View */,
387FF9BE24D7EFE3001BF8E3 /* ViewModel */,
);
path = "MovieAppUI - Week 6";
sourceTree = "<group>";
};
387FF9BE24D7EFE3001BF8E3 /* ViewModel */ = {
isa = PBXGroup;
children = (
387FF9C524D7F043001BF8E3 /* MovieDetailViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
387FF9BF24D7EFEB001BF8E3 /* View */ = {
isa = PBXGroup;
children = (
387FF9C324D7F036001BF8E3 /* MovieDetailView.swift */,
387FF9C724D7F65F001BF8E3 /* SubViews */,
);
path = View;
sourceTree = "<group>";
};
387FF9C024D7EFF0001BF8E3 /* Model */ = {
isa = PBXGroup;
children = (
387FF9C124D7F02B001BF8E3 /* MovieDetailModel.swift */,
);
path = Model;
sourceTree = "<group>";
};
387FF9C724D7F65F001BF8E3 /* SubViews */ = {
isa = PBXGroup;
children = (
387FF9C824D7F678001BF8E3 /* TagScrollView.swift */,
387FF9CA24D7F99D001BF8E3 /* MovieDetailImageView.swift */,
387FF9CE24D7FEB4001BF8E3 /* MovieRatingView.swift */,
387FF9D024D80958001BF8E3 /* ImageAndRatingView.swift */,
387FF9D224D81486001BF8E3 /* MovieSubDetailView.swift */,
387FF9D424D81B50001BF8E3 /* MovieDetailDescriptionView.swift */,
387FF9D624D829D4001BF8E3 /* CrewAndCastView.swift */,
);
path = SubViews;
sourceTree = "<group>";
};
387FF9D824D8517D001BF8E3 /* AsyncImage */ = {
isa = PBXGroup;
children = (
387FF9D924D85193001BF8E3 /* AsyncImage.swift */,
387FF9DB24D851AC001BF8E3 /* ImageCache.swift */,
387FF9DD24D851CB001BF8E3 /* ImageLoader.swift */,
387FF9DF24D851E5001BF8E3 /* EnvironmentValues+ImageCache.swift */,
);
path = AsyncImage;
sourceTree = "<group>";
};
388B9B1724CFF9EE00E97320 /* LoginView - Week 5 */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -324,7 +414,9 @@
388B9B3624D01B2D00E97320 /* Utilities */ = {
isa = PBXGroup;
children = (
387FF9D824D8517D001BF8E3 /* AsyncImage */,
388B9B3724D01B3F00E97320 /* Constants.swift */,
387FF9CC24D7F9E0001BF8E3 /* CornerRadiusViewModifier.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -481,6 +573,7 @@
38A439C024BC32BF00CA4CEB /* List - Week 3 */,
386B8C1B24C7174A00162409 /* SegmentController - Week 4 */,
388B9B1724CFF9EE00E97320 /* LoginView - Week 5 */,
387FF9BD24D7EFAC001BF8E3 /* MovieAppUI - Week 6 */,
);
path = Components;
sourceTree = "<group>";
Expand Down Expand Up @@ -710,40 +803,55 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
387FF9C924D7F678001BF8E3 /* TagScrollView.swift in Sources */,
38A439C524BC330B00CA4CEB /* ListEnum.swift in Sources */,
38E0D39E24D1ADA50010C878 /* TextFieldView.swift in Sources */,
38A439CC24BC339900CA4CEB /* HomeScrollView.swift in Sources */,
38D25C5524A9D26B00AD202F /* SwiftUILearning.xcdatamodeld in Sources */,
386B8C2424C717DD00162409 /* SegmentControllerViewModel.swift in Sources */,
387FF9D324D81486001BF8E3 /* MovieSubDetailView.swift in Sources */,
38E0D39924D1AC1A0010C878 /* LoginEnum.swift in Sources */,
387FF9C424D7F036001BF8E3 /* MovieDetailView.swift in Sources */,
387FF9E024D851E5001BF8E3 /* EnvironmentValues+ImageCache.swift in Sources */,
384ECA7524B3614E00D2CDC0 /* ImageListViewModel.swift in Sources */,
388B9B3824D01B3F00E97320 /* Constants.swift in Sources */,
38D25C8624A9D2E600AD202F /* TextSwiftUIView.swift in Sources */,
384ECA6924B3060F00D2CDC0 /* ImageListView.swift in Sources */,
38E0D3A024D1AEAD0010C878 /* SecureTextFieldView.swift in Sources */,
387FF9D524D81B50001BF8E3 /* MovieDetailDescriptionView.swift in Sources */,
386B8C2024C717AA00162409 /* SegmentControllerModel.swift in Sources */,
3890EFCB24C9C4FE004EB658 /* TeamDetailsView.swift in Sources */,
38A439D624BC72B500CA4CEB /* SocialMediaListRow.swift in Sources */,
3891E56324C80EAD00D4C661 /* TeamListRow.swift in Sources */,
387FF9CF24D7FEB4001BF8E3 /* MovieRatingView.swift in Sources */,
38D25C8B24A9D65400AD202F /* ContentViewModel.swift in Sources */,
38A439CE24BC33AD00CA4CEB /* ListHomeViewModel.swift in Sources */,
38A439CA24BC337E00CA4CEB /* ListTypeView.swift in Sources */,
38C0CC9E24D1B44E00A6192C /* ForgotPasswordView.swift in Sources */,
387FF9DA24D85193001BF8E3 /* AsyncImage.swift in Sources */,
384ECA6C24B30F6A00D2CDC0 /* ImageRowView.swift in Sources */,
38D25C5024A9D26B00AD202F /* AppDelegate.swift in Sources */,
387FF9C224D7F02B001BF8E3 /* MovieDetailModel.swift in Sources */,
387FF9D124D80958001BF8E3 /* ImageAndRatingView.swift in Sources */,
38A439D124BC4C2F00CA4CEB /* ListHomeModel.swift in Sources */,
38E0D39624D1A5500010C878 /* LoginViewModel.swift in Sources */,
38D25C9124A9D81700AD202F /* ContentEnum.swift in Sources */,
387FF9DE24D851CB001BF8E3 /* ImageLoader.swift in Sources */,
387FF9CB24D7F99D001BF8E3 /* MovieDetailImageView.swift in Sources */,
38E0D39C24D1ACB30010C878 /* HeaderView.swift in Sources */,
386B8C2724C718C400162409 /* SegmentControllerListView.swift in Sources */,
387FF9CD24D7F9E0001BF8E3 /* CornerRadiusViewModifier.swift in Sources */,
38E0D3A224D1AF790010C878 /* RoundedButtonView.swift in Sources */,
386B8C2924C718D100162409 /* SegmentControllerScrollView.swift in Sources */,
38D25C5724A9D26B00AD202F /* ContentView.swift in Sources */,
38D25C8E24A9D75E00AD202F /* ContentModel.swift in Sources */,
387FF9DC24D851AC001BF8E3 /* ImageCache.swift in Sources */,
388B9B1C24CFFA2900E97320 /* LoginView.swift in Sources */,
38A439C724BC336100CA4CEB /* ListHomeView.swift in Sources */,
38E0D3A724D1B1E30010C878 /* LoginModel.swift in Sources */,
38E0D3AD24D1B2D50010C878 /* UIApplication+Extension.swift in Sources */,
387FF9D724D829D4001BF8E3 /* CrewAndCastView.swift in Sources */,
387FF9C624D7F043001BF8E3 /* MovieDetailViewModel.swift in Sources */,
38D25C5224A9D26B00AD202F /* SceneDelegate.swift in Sources */,
384ECA6F24B30F7E00D2CDC0 /* TextAndImageView.swift in Sources */,
38E0D3AC24D1B2D50010C878 /* String+Extension.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,14 @@
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SwiftErrorBreakpoint">
<BreakpointContent
uuid = "2CE61F4C-F6C0-4472-A8D8-36A805C016E7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ enum ComponentType: String {
case list = "List"
case segmentControll = "Segment Controll"
case login = "Login"
case movieDetail = "Movie Detail"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class ContentViewModel {
ContentModel(id: 2, contentType: ComponentType.image.rawValue),
ContentModel(id: 3, contentType: ComponentType.list.rawValue),
ContentModel(id: 4, contentType: ComponentType.segmentControll.rawValue),
ContentModel(id: 5, contentType: ComponentType.login.rawValue)]
ContentModel(id: 5, contentType: ComponentType.login.rawValue),
ContentModel(id: 6, contentType: ComponentType.movieDetail.rawValue)]

// MARK: - User define methods
/// Method to get destination view
Expand All @@ -36,6 +37,8 @@ class ContentViewModel {
return AnyView(SegmentControllerView())
case .login:
return AnyView(LoginView())
case .movieDetail:
return AnyView(MovieDetailView(movieDetailModel: DummyMovieDetailData.model))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//
// MovieDetailModel.swift
// SwiftUILearning
//
// Created by Shikalgar, Shahrukh on 03/08/20.
// Copyright © 2020 Shahrukh Shikalgar. All rights reserved.
//

import Foundation

// MARK: - MovieDetail Model
/// Model for MovieDetail
struct MovieDetailModel: Codable, Identifiable, Hashable {
let id: Int
let poster: String
let moviewDetail: MovieDetail
let ratingDetails: RatingDetails
let details: Details
let crewAndCasts: [CrewAndCast]
}

// MARK: - CrewAndCast
struct CrewAndCast: Codable, Identifiable, Hashable {
let id: Int
let icon: String
let name, type: String
}

// MARK: - Details
struct Details: Codable, Identifiable, Hashable {
let id: Int
let detailsDescription: String

enum CodingKeys: String, CodingKey {
case id
case detailsDescription = "description"
}
}

// MARK: - MoviewDetail
struct MovieDetail: Codable, Identifiable, Hashable {
let id: Int
let title, year, rating, duration: String
let tags: [String]
}

// MARK: - RatingDetails
struct RatingDetails: Codable, Identifiable, Hashable {
let id: Int
let rate: Rate
let metascore: Metascore
}

// MARK: - Metascore
struct Metascore: Codable, Identifiable, Hashable {
let id: Int
let score, critics: String
}

// MARK: - Rate
struct Rate: Codable, Identifiable, Hashable {
let id: Int
let star, total: String
}

struct DummyMovieDetailData {
static let model = MovieDetailModel(id: 0,
poster: "https://image.tmdb.org/t/p/original//6ApDtO7xaWAfPqfi2IARXIzj8QS.jpg",
moviewDetail: MovieDetail(id: 1,
title: "Ford v Ferrari",
year: "2019",
rating: "PG-13",
duration: "2h 32min",
tags: ["Action", "Biography", "Drama", "Sports"]),
ratingDetails: RatingDetails(id: 1,
rate: Rate(id: 1,
star: "8.2",
total: "166,839"),
metascore: Metascore(id: 1,
score: "86",
critics: "82")),
details: Details(id: 1,
detailsDescription: "American car designer Carroll Shelby and driver Ken Miles battle corporate interference and the laws of physics to build a revolutionary race car for Ford in order to defeat Ferrari at the 24 Hours of Le Mans in 1966."),
crewAndCasts: [
CrewAndCast(id: 1,
icon: "https://m.media-amazon.com/images/M/MV5BMTg5MjY0ODg1MF5BMl5BanBnXkFtZTYwMjUzMjc0._V1_UX214_CR0,0,214,317_AL__QL50.jpg",
name: "James Mangold",
type: "Director"),
CrewAndCast(id: 2,
icon: "https://image.tmdb.org/t/p/original/eLAWpp5BLbTwjj35MbGzpL0QkWv.jpg",
name: "Matt Damon",
type: "Carroll"),
CrewAndCast(id: 3,
icon: "https://image.tmdb.org/t/p/original/pPXnqoGD91znz4FwQ6aKuxi6Pcy.jpg",
name: "Christian Bale",
type: "Ken Miles"),
CrewAndCast(id: 4,
icon: "https://static01.nyt.com/images/2019/11/07/arts/07minutes1/merlin_160562580_735c80c2-5f10-4332-8489-f054024d17d0-articleLarge.jpg?quality=75&auto=webp&disable=upscale",
name: "Tracy Letts",
type: "Henry Ford II"),
CrewAndCast(id: 5,
icon: "https://www.refinery29.com/images/9691792.jpg?format=jpg&width=340&height=408&quality=80",
name: "Caitriona Balfe",
type: "Mollie Miles")])
}
Loading

0 comments on commit cfcb7b3

Please sign in to comment.