comparison LazyBearWatchOS Extension/Views/Helpers/WatchOSNewsRow.swift @ 455:b560babcd5ed

WatchOS views implemented
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Mon, 28 Jun 2021 11:55:19 +0200
parents
children c6913f0ce46e
comparison
equal deleted inserted replaced
454:c79a3ed3d230 455:b560babcd5ed
1 //
2 // WatchOSNewsRow.swift
3 // LazyBearWatchOS Extension
4 //
5 // Created by Dennis Concepción Martín on 27/06/2021.
6 //
7
8 import SwiftUI
9
10 struct WatchOSNewsRow: View {
11 var new: LatestNewsModel
12
13 var body: some View {
14 HStack {
15 VStack(alignment: .leading) {
16 Text("\(convertEpoch(new.datetime, true)) ago")
17 .font(.footnote)
18 .opacity(0.5)
19
20 Text(new.headline.capitalized)
21 .font(.headline)
22 .fontWeight(.semibold)
23 .fixedSize(horizontal: false, vertical: true) /// I need to add this to make lineLimit works correctly
24 .lineLimit(3)
25 }
26 }
27 }
28 }
29
30 struct WatchOSNewsRow_Previews: PreviewProvider {
31 static var previews: some View {
32 WatchOSNewsRow(
33 new: LatestNewsModel(
34 datetime: 1621037430000,
35 headline: "Chaos Monkeys' author calls Apple's statement on his departure defamatory",
36 image: "https://cloud.iexapis.com/v1/news/image/99abeb99-6d9e-47c8-ae7b-53404eacccec",
37 source: "Investing.com",
38 summary: "https://www.investing.com/news/stock-market-news",
39 url: "https://bloomberg.com")
40 )
41 }
42 }