Skip to content

Commit

Permalink
feat: init TrackView
Browse files Browse the repository at this point in the history
  • Loading branch information
angristan committed Jul 21, 2021
1 parent 9635a7a commit 452f847
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
4 changes: 4 additions & 0 deletions firstfm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
8226AB2226998A86007ECE5F /* TopCountryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8226AB2126998A86007ECE5F /* TopCountryViewModel.swift */; };
8226AB2426998FAB007ECE5F /* TopCountryArtistsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8226AB2326998FAB007ECE5F /* TopCountryArtistsResponse.swift */; };
822E9A8A26A89BFE00C5307B /* UserTopArtistsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 822E9A8926A89BFE00C5307B /* UserTopArtistsResponse.swift */; };
822E9A8C26A8CFAC00C5307B /* TrackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 822E9A8B26A8CFAC00C5307B /* TrackView.swift */; };
82505CDF2675074E00CCCB58 /* ArtistRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82505CDC2675074E00CCCB58 /* ArtistRow.swift */; };
82505CE02675074E00CCCB58 /* ChartListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82505CDD2675074E00CCCB58 /* ChartListView.swift */; };
82505CE12675074E00CCCB58 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82505CDE2675074E00CCCB58 /* ContentView.swift */; };
Expand Down Expand Up @@ -105,6 +106,7 @@
8226AB2126998A86007ECE5F /* TopCountryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopCountryViewModel.swift; sourceTree = "<group>"; };
8226AB2326998FAB007ECE5F /* TopCountryArtistsResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopCountryArtistsResponse.swift; sourceTree = "<group>"; };
822E9A8926A89BFE00C5307B /* UserTopArtistsResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserTopArtistsResponse.swift; sourceTree = "<group>"; };
822E9A8B26A8CFAC00C5307B /* TrackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackView.swift; sourceTree = "<group>"; };
82505CDC2675074E00CCCB58 /* ArtistRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArtistRow.swift; sourceTree = "<group>"; };
82505CDD2675074E00CCCB58 /* ChartListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartListView.swift; sourceTree = "<group>"; };
82505CDE2675074E00CCCB58 /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -210,6 +212,7 @@
82505CDD2675074E00CCCB58 /* ChartListView.swift */,
82505CDE2675074E00CCCB58 /* ContentView.swift */,
82A006C426797C3E0009BD71 /* SearchView.swift */,
822E9A8B26A8CFAC00C5307B /* TrackView.swift */,
);
name = Views;
path = firstfm/Views;
Expand Down Expand Up @@ -567,6 +570,7 @@
82C282E226A31CFD000E5F41 /* StringMD5.swift in Sources */,
825F0F8926A4B2E0007BA84B /* ArtistInfoResponse.swift in Sources */,
82C282E826A3332E000E5F41 /* FriendsResponse.swift in Sources */,
822E9A8C26A8CFAC00C5307B /* TrackView.swift in Sources */,
820455E0267ABC930009A418 /* AuthViewModel.swift in Sources */,
825F0FC526A74539007BA84B /* TopArtistAlbumsView.swift in Sources */,
4A8C296126983B7300F55ECC /* LastFMAPI.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion firstfm/Views/ChartListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct ChartList: View {
if selectedChartsIndex == 1 {
List(charts.tracks) { track in
NavigationLink(
destination: Color(.blue),
destination: TrackView(track: track),
label: {
TrackRow(track: track)
})
Expand Down
62 changes: 62 additions & 0 deletions firstfm/Views/TrackView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import SwiftUI
import Kingfisher

struct TrackView: View {
// @ObservedObject private var vm = TrackViewModel()
var track: Track

var body: some View {
GeometryReader { _ in
ScrollView {
GeometryReader { geometry in
ZStack {
if geometry.frame(in: .global).minY <= 0 {
KFImage.url(URL(string: !self.track.image.isEmpty ? self.track.image[0].url : "https://www.nme.com/wp-content/uploads/2021/04/twice-betterconceptphoto-2020.jpg")!)
.resizable()
.loadImmediately()
.aspectRatio(contentMode: .fill)
.overlay(TintOverlayView().opacity(0.2))
.frame(width: geometry.size.width, height: geometry.size.height)
.offset(y: geometry.frame(in: .global).minY/9)
.clipped()
} else {
KFImage.url(URL(string: !self.track.image.isEmpty ? self.track.image[0].url : "https://www.nme.com/wp-content/uploads/2021/04/twice-betterconceptphoto-2020.jpg")!)
.resizable()
.loadImmediately()
.aspectRatio(contentMode: .fill)
.overlay(TintOverlayView().opacity(0.2))
.frame(width: geometry.size.width, height: geometry.size.height + geometry.frame(in: .global).minY)
.clipped()
.offset(y: -geometry.frame(in: .global).minY)
}
}
}.frame(height: 200)

HStack {
VStack {
Text("Scrobbles")
Text("50k")
}
VStack {
Text("Listeners")
Text("52k")
}
Image(systemName: "heart")
}
Divider()
HStack {
Text("tag")
Text("tag")
Text("tag")
Text("tag")
}
Divider()
Text("[img] Artist ->")
Divider()
Text("From the album")
Text("[img] Album ->")
}
}

}
}

0 comments on commit 452f847

Please sign in to comment.