Skip to content

Instantly share code, notes, and snippets.

@TGNYC
Created April 29, 2022 02:17
Show Gist options
  • Select an option

  • Save TGNYC/c580eef25c0ddb286e59dd2374acf267 to your computer and use it in GitHub Desktop.

Select an option

Save TGNYC/c580eef25c0ddb286e59dd2374acf267 to your computer and use it in GitHub Desktop.
struct
struct DetailedArtistView: View {
// INSERT THINGS TO BE PASSED IN
@Binding var imageURLs: [String]
@Binding var detailedTitle: String
@Binding var topGenres: [String]
@Binding var followers: String
@Binding var linkToSpot: String
@Binding var popularity: String
// init() {
// let numberFormatter = NumberFormatter()
// numberFormatter.numberStyle = .decimal
// }
var body: some View {
HStack(spacing: 20) {
AsyncImage(url: URL(string: imageURLs[0])) { image in
image.resizable()
.aspectRatio(contentMode: .fill)
} placeholder: {
Color.gray
}
.aspectRatio(contentMode: .fill)
// .frame(width: 180, height: 180)
// .clipShape(RoundedRectangle(cornerSize: CGSize(width: 30,height: 30)))
// .clipped()
//x .padding(.top, 4)
}
Text(detailedTitle)
.font(.title)
.fontWeight(.bold)
.foregroundColor(Color.green)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 10)
// .padding(.bottom, 5)
.lineSpacing(1)
// .font(.system(size: 20)
// .bold())
// .padding(.top, 8)
VStack() {
Group {
RoundedRectangle(cornerRadius: 25, style: .continuous)
.fill(Color.gray)
.overlay(
HStack() {
Text("Followers:").bold()
Text(followers)
}.font(.body)
.foregroundColor(Color.white)
)
RoundedRectangle(cornerRadius: 25, style: .continuous)
.fill(Color.gray)
.overlay(
HStack() {
Text("Popularity:").bold()
Text(popularity + "/100")
}.font(.body)
.foregroundColor(Color.white)
)
RoundedRectangle(cornerRadius: 25, style: .continuous)
.fill(Color.gray)
.overlay(
HStack() {
Text("Top Genres:").bold()
ForEach(topGenres, id: \.self){ genre in
Text(genre)
}
} .font(.body)
.foregroundColor(Color.white)
)
}
.frame(maxWidth: .infinity)
// .border(Color.red)
// .background(Color.gray)
// .foregroundColor(Color.white)
// .font(.body)
.padding(1)
.cornerRadius(2)
}
Link(destination: URL(string: linkToSpot)!) {
Text("View in Spotify")
.fontWeight(.bold)
.font(.title)
.padding()
.background(Color.green)
.foregroundColor(.white)
.cornerRadius(40)
.padding(10)
}
// VStack{
// HStack(spacing: 20) {
// AsyncImage(url: URL(string: imageURLs[0])) { image in
// image.resizable()
// } placeholder: {
// Color.gray
// }
// .aspectRatio(contentMode: .fill)
// .frame(width: 180, height: 180)
// .clipShape(RoundedRectangle(cornerSize: CGSize(width: 30,height: 30)))
// .clipped()
// .padding(.top, 4)
// }
// }
// Text(detailedTitle)
// .font(.system(size: 20)
// .bold())
// .padding(.top, 8)
//// Text("Genres: " + topGenres[0] + ", " + topGenres[1])
// .padding()
// Text("Followers: " + followers)
// .padding()
// Text("Popularity Score: " + popularity + "/100")
// .padding()
// Link("Spotify Profile", destination: URL(string: linkToSpot)!)
// .padding()
}
// func addCommas() -> String {
// let numberFormatter = NumberFormatter()
// numberFormatter.numberStyle = .decimal
// return numberFormatter.string(from: NSNumber(value:self))!
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment