-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Karan Bhasin
committed
Aug 29, 2020
1 parent
f8748b4
commit a57b63f
Showing
27 changed files
with
642 additions
and
1 deletion.
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
Binary file modified
BIN
+25.4 KB
(180%)
...eproj/project.xcworkspace/xcuserdata/karbhasin.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
Binary file added
BIN
+68.7 KB
SwiftUI_Starter/Assets.xcassets/Caitriona Balfe.imageset/Caitriona Balfe.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
SwiftUI_Starter/Assets.xcassets/Caitriona Balfe.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Caitriona Balfe.jpg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Binary file added
BIN
+92.2 KB
SwiftUI_Starter/Assets.xcassets/Christian Bale.imageset/Christian Bale.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
SwiftUI_Starter/Assets.xcassets/Christian Bale.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Christian Bale.jpg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
SwiftUI_Starter/Assets.xcassets/Ford V Ferrari.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Ford V Ferrari.jpeg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Binary file added
BIN
+159 KB
SwiftUI_Starter/Assets.xcassets/Ford V Ferrari.imageset/Ford V Ferrari.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
SwiftUI_Starter/Assets.xcassets/James Mangold.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "James Mangold.jpg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Binary file added
BIN
+10.2 KB
SwiftUI_Starter/Assets.xcassets/James Mangold.imageset/James Mangold.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
SwiftUI_Starter/Assets.xcassets/Matt Damon.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Matt Damon.jpg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
// | ||
// CastAndCrewSingleView.swift | ||
// SwiftUI_Starter | ||
// | ||
// Created by Karan Bhasin on 29/08/20. | ||
// Copyright © 2020 Karan Bhaisn. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct CastAndCrewSingleView: View { | ||
var castAndCrew: CastAndCrew | ||
var body: some View { | ||
return VStack(spacing: 3) { | ||
Image(castAndCrew.image) | ||
.resizable() | ||
.aspectRatio(contentMode: .fill) | ||
.frame(width: 80, height: 80) | ||
.cornerRadius(40) | ||
Text(castAndCrew.name) | ||
.frame(width: 100) | ||
.multilineTextAlignment(.center) | ||
.fixedSize(horizontal: false, vertical: true) | ||
Text(castAndCrew.designation) | ||
.font(.subheadline) | ||
.frame(width: 100) | ||
.foregroundColor(.secondary) | ||
} | ||
} | ||
} | ||
|
||
struct CastAndCrewSingleView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
CastAndCrewSingleView(castAndCrew: CastAndCrew(name: "JK", designation: "kjhgjk")) | ||
} | ||
} |
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,33 @@ | ||
// | ||
// CastAndCrewsView.swift | ||
// SwiftUI_Starter | ||
// | ||
// Created by Karan Bhasin on 29/08/20. | ||
// Copyright © 2020 Karan Bhaisn. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct CastAndCrewsView: View { | ||
let castAndCrews: [CastAndCrew] | ||
|
||
var body: some View { | ||
VStack(alignment: .leading) { | ||
Text("Cast and Crew") | ||
.padding(.all) | ||
ScrollView(.horizontal, showsIndicators: false) { | ||
HStack(alignment: .top, spacing: 10) { | ||
ForEach(castAndCrews) { castAndCrew in | ||
CastAndCrewSingleView(castAndCrew: castAndCrew) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct CastAndCrewsView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
CastAndCrewsView(castAndCrews: [CastAndCrew(name: "K", designation: "Mr. K"), CastAndCrew(name: "B", designation: "Mr. B")]) | ||
} | ||
} |
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,37 @@ | ||
// | ||
// CornerRadiusViewModifier.swift | ||
// SwiftUI_Starter | ||
// | ||
// Created by Karan Bhasin on 29/08/20. | ||
// Copyright © 2020 Karan Bhaisn. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct CornerRadiusViewModifier: ViewModifier { | ||
var radius: CGFloat | ||
var corners: UIRectCorner | ||
|
||
struct CornerRadiusShape: Shape { | ||
|
||
var radius = CGFloat.infinity | ||
var corners = UIRectCorner.allCorners | ||
|
||
func path(in rect: CGRect) -> Path { | ||
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius)) | ||
return Path(path.cgPath) | ||
} | ||
} | ||
|
||
func body(content: Content) -> some View { | ||
content | ||
.clipShape(CornerRadiusShape(radius: radius, corners: corners)) | ||
} | ||
} | ||
|
||
extension View { | ||
func cornerRadius(radius: CGFloat, corners: UIRectCorner) -> some View { | ||
ModifiedContent(content: self, modifier: CornerRadiusViewModifier(radius: radius, corners: corners)) | ||
} | ||
} | ||
|
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,53 @@ | ||
// | ||
// GenreView.swift | ||
// SwiftUI_Starter | ||
// | ||
// Created by Karan Bhasin on 29/08/20. | ||
// Copyright © 2020 Karan Bhaisn. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct GenreView: View { | ||
var body: some View { | ||
return HStack(spacing: 15) { | ||
Button(action: actionMethod) { | ||
Text("Action") | ||
.padding([.leading,.trailing], 20) | ||
.padding([.top,.bottom], 5) | ||
.overlay( | ||
Capsule(style: .continuous) | ||
.stroke(Color.gray, lineWidth: 1) | ||
) | ||
}.accentColor(.black) | ||
Button(action: actionMethod) { | ||
Text("Biography") | ||
.padding([.leading,.trailing], 20) | ||
.padding([.top,.bottom], 5) | ||
.overlay( | ||
Capsule(style: .continuous) | ||
.stroke(Color.gray, lineWidth: 1) | ||
) | ||
}.accentColor(.black) | ||
Button(action: actionMethod) { | ||
Text("Drama") | ||
.padding([.leading,.trailing], 20) | ||
.padding([.top,.bottom], 5) | ||
.overlay( | ||
Capsule(style: .continuous) | ||
.stroke(Color.gray, lineWidth: 1) | ||
) | ||
}.accentColor(.black) | ||
}.padding([.top], 10) | ||
} | ||
|
||
func actionMethod() { | ||
|
||
} | ||
} | ||
|
||
struct GenreView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
GenreView() | ||
} | ||
} |
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,26 @@ | ||
// | ||
// ImageAndRatingsView.swift | ||
// SwiftUI_Starter | ||
// | ||
// Created by Karan Bhasin on 29/08/20. | ||
// Copyright © 2020 Karan Bhaisn. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ImageAndRatingsView: View { | ||
var image: String | ||
|
||
var body: some View { | ||
ZStack(alignment: .bottomTrailing) { | ||
MovieImageView(image: image) | ||
MovieRatingsView() | ||
} | ||
} | ||
} | ||
|
||
struct ImageAndRatingsView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ImageAndRatingsView(image: "apple") | ||
} | ||
} |
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,44 @@ | ||
// | ||
// Movie.swift | ||
// SwiftUI_Starter | ||
// | ||
// Created by Karan Bhasin on 29/08/20. | ||
// Copyright © 2020 Karan Bhaisn. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct Movie : Identifiable { | ||
var id = UUID() | ||
var name: String | ||
var description: String | ||
var castAndCrews: [CastAndCrew] | ||
|
||
var image: String { return name } | ||
} | ||
|
||
struct CastAndCrew: Identifiable { | ||
var id = UUID() | ||
let name: String | ||
let designation: String | ||
var image: String { return name } | ||
|
||
// static func data() -> [ListModel] { | ||
// return [ListModel(id: 0, name: "Karan", imageName: "Bhasin"), | ||
// ListModel(id: 0, name: "Nila", imageName: "Akash"), | ||
// ListModel(id: 0, name: "Nitin", imageName: "Pant"), | ||
// ListModel(id: 0, name: "Deepak", imageName: "Carpenter"), | ||
// ListModel(id: 0, name: "Dileep", imageName: "M")] | ||
// } | ||
} | ||
|
||
let testMovieDetailData = Movie(name: "Ford V Ferrari", | ||
description: "American automotive designer Carroll Shelby and fearless British race car driver Ken Miles battle corporate interference, the laws of physics and their own personal demons to build a revolutionary vehicle for the Ford Motor Co.", | ||
castAndCrews: testCastAndCrewData) | ||
|
||
let testCastAndCrewData = [ | ||
CastAndCrew(name: "James Mangold", designation: "Director"), | ||
CastAndCrew(name: "Matt Damon", designation: "Carroll"), | ||
CastAndCrew(name: "Christian Bale", designation: "Ken Miles"), | ||
CastAndCrew(name: "Caitriona Balfe", designation: "Mollie") | ||
] |
Oops, something went wrong.