Created
September 13, 2021 23:09
-
-
Save rudrankriyam/4ec5b06e81b22e2a6a1c4080eb0afcf1 to your computer and use it in GitHub Desktop.
ShazamMusicCard
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
import SwiftUI | |
struct ShazamMusicCard: View { | |
var item: SHMediaItem | |
var body: some View { | |
HStack { | |
ArtworkImage(url: url) { image in | |
image | |
.scaledToFit() | |
.transition(.opacity.combined(with: .scale)) | |
} | |
.cornerRadius(12.0) | |
.frame(width: 100.0, height: 100.0) | |
VStack(alignment: .leading, spacing: 4.0) { | |
Text(name) | |
.fontWeight(.bold) | |
.font(.callout) | |
Text(artistName) | |
.fontWeight(.light) | |
.font(.caption) | |
} | |
.foregroundColor(.white) | |
.frame(maxWidth: .infinity, alignment: .leading) | |
.multilineTextAlignment(.leading) | |
} | |
} | |
private var name: String { | |
item.title ?? "" | |
} | |
private var artistName: String { | |
item.artist ?? "" | |
} | |
private var url: URL? { | |
item.artworkURL | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment