-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from novoda/feature/rm-57-CharacterDetailView
Feature [RM57] CharacterDetailView
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
36 changes: 36 additions & 0 deletions
36
Rick-and-Morty/Rick And Morty/Views/CharacterDetailView.swift
This file contains 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
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]) | ||
} | ||
} |