Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature [RM57] CharacterDetailView #58

Merged
merged 1 commit into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Rick-and-Morty/Rick And Morty.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1711B39C26B16D6200BE935B /* CharactersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1711B39B26B16D6200BE935B /* CharactersView.swift */; };
1711B39E26B1898100BE935B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1711B39D26B1898100BE935B /* ContentView.swift */; };
171752C126B3FD50007B1A60 /* CharacterDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 171752C026B3FD50007B1A60 /* CharacterDetailView.swift */; };
17CAB4FA26A824470048F2F1 /* CharacterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17CAB4F926A824470048F2F1 /* CharacterCell.swift */; };
17F1E38626A1AF6A009C1CDB /* Character.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17F1E38526A1AF6A009C1CDB /* Character.swift */; };
17F1E38D26A1DCF0009C1CDB /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17F1E38C26A1DCF0009C1CDB /* Data.swift */; };
Expand All @@ -33,6 +34,7 @@
/* Begin PBXFileReference section */
1711B39B26B16D6200BE935B /* CharactersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharactersView.swift; sourceTree = "<group>"; };
1711B39D26B1898100BE935B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
171752C026B3FD50007B1A60 /* CharacterDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterDetailView.swift; sourceTree = "<group>"; };
17CAB4F926A824470048F2F1 /* CharacterCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCell.swift; sourceTree = "<group>"; };
17F1E38526A1AF6A009C1CDB /* Character.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Character.swift; sourceTree = "<group>"; };
17F1E38C26A1DCF0009C1CDB /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -83,6 +85,7 @@
17CAB4F926A824470048F2F1 /* CharacterCell.swift */,
1711B39B26B16D6200BE935B /* CharactersView.swift */,
1711B39D26B1898100BE935B /* ContentView.swift */,
171752C026B3FD50007B1A60 /* CharacterDetailView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -231,6 +234,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
171752C126B3FD50007B1A60 /* CharacterDetailView.swift in Sources */,
17F1E38D26A1DCF0009C1CDB /* Data.swift in Sources */,
1711B39E26B1898100BE935B /* ContentView.swift in Sources */,
B811686D1CFF1C9900301A0A /* AppDelegate.swift in Sources */,
Expand Down
36 changes: 36 additions & 0 deletions Rick-and-Morty/Rick And Morty/Views/CharacterDetailView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// CharacterDetailView.swift
// Rick And Morty
//
// Created by Scottie Gray on 2021-07-30.
// Copyright © 2021 Novoda. All rights reserved.
//

import SwiftUI

struct CharacterDetailView: View {
let character: Character

var body: some View {
VStack {
Image(character.image)
.resizable()
.scaledToFit()
.frame(maxHeight: 200)
HStack {
Text(character.description)
Spacer()
}
Spacer()
}
.padding()
.navigationTitle(character.name)
}
}

struct CharacterDetailView_Previews: PreviewProvider {
static var previews: some View {
CharacterDetailView(character: ricks[0])
CharacterDetailView(character: morties[0])
}
}