[Framework] Feed item view in the Feed framework (#10)

This PR contains the work done to implement the `FeedItemViewController` view controller, that shows in details a selected review from the `FeedListViewController` view controller.

Reviewed-on: rock-n-code/app-reviews#10
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #10.
This commit is contained in:
2024-03-20 01:42:21 +00:00
committed by javier
parent 09df006ab9
commit c9f4b9a677
12 changed files with 554 additions and 143 deletions
@@ -1,14 +1,15 @@
//
// FeedItem.swift
// FeedItemCell.swift
// ReviewsFeed
//
// Created by Javier Cicchelli on 19/03/2024.
// Copyright © 2024 Röck+Cöde. All rights reserved.
//
import ReviewsUIKit
import SwiftUI
struct FeedItem: View {
struct FeedItemCell: View {
// MARK: Constants
private let item: Review
@@ -24,15 +25,11 @@ struct FeedItem: View {
alignment: .leading,
spacing: 16
) {
HStack(
alignment: .bottom,
spacing: 8
) {
Image(systemName: "person.crop.circle")
Text(item.author)
.font(.subheadline)
}
FakeLabel(
systemIcon: .Icon.person,
title: item.author
)
.foregroundColor(.secondary)
VStack(spacing: 8) {
Text(item.title)
@@ -47,28 +44,21 @@ struct FeedItem: View {
}
.multilineTextAlignment(.leading)
HStack(alignment: .bottom) {
ForEach(1...5, id: \.self) { index in
if #available(iOS 15.0, *) {
Image(systemName: "star")
.symbolVariant(index <= item.rating.stars ? .fill : .none)
} else {
Image(systemName: index <= item.rating.stars ? "star.fill" : "star")
}
}
Spacer()
HStack(
alignment: .center,
spacing: 32
) {
StarRating(
item.rating.stars,
of: .Rating.total
)
HStack(
alignment: .bottom,
spacing: 4
) {
Text(item.rating.appVersion)
Image(systemName: "iphone.gen3.circle")
}
FakeLabel(
systemIcon: .Icon.info,
title: item.rating.appVersion
)
.foregroundColor(.secondary)
}
.font(.subheadline)
}
.padding(.vertical, 8)
}
@@ -76,8 +66,8 @@ struct FeedItem: View {
}
// MARK: - Previews
#Preview("Feed Item") {
FeedItem(.init(
#Preview("Feed Item Cell") {
FeedItemCell(.init(
author: "Some author name here...",
comment: "Some review comment here...",
id: 0,
@@ -87,4 +77,5 @@ struct FeedItem: View {
),
title: "Some review title here..."
))
.padding(.horizontal)
}