Skip to content

Commit

Permalink
Merge pull request #91 from nimblehq/release/0.6.0
Browse files Browse the repository at this point in the history
Release 0.6.0
  • Loading branch information
Thieurom authored Jan 10, 2023
2 parents afdfa92 + 5367764 commit 8f21688
Show file tree
Hide file tree
Showing 43 changed files with 958 additions and 680 deletions.
8 changes: 4 additions & 4 deletions CryptoPrices.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.5.0;
MARKETING_VERSION = 0.6.0;
PRODUCT_BUNDLE_IDENTIFIER = "co.nimblehq.crypto-prices.staging";
PRODUCT_MODULE_NAME = CryptoPrices;
PRODUCT_NAME = "$(TARGET_NAME) Staging";
Expand Down Expand Up @@ -682,7 +682,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.5.0;
MARKETING_VERSION = 0.6.0;
PRODUCT_BUNDLE_IDENTIFIER = "co.nimblehq.crypto-prices.staging";
PRODUCT_MODULE_NAME = CryptoPrices;
PRODUCT_NAME = "$(TARGET_NAME) Staging";
Expand Down Expand Up @@ -871,7 +871,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.5.0;
MARKETING_VERSION = 0.6.0;
PRODUCT_BUNDLE_IDENTIFIER = "co.nimblehq.crypto-prices";
PRODUCT_MODULE_NAME = CryptoPrices;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -908,7 +908,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.5.0;
MARKETING_VERSION = 0.6.0;
PRODUCT_BUNDLE_IDENTIFIER = "co.nimblehq.crypto-prices";
PRODUCT_MODULE_NAME = CryptoPrices;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"pins" : [
{
"identity" : "charts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/danielgindi/Charts.git",
"state" : {
"revision" : "07b23476ad52b926be772f317d8f1d4511ee8d02",
"version" : "4.1.0"
}
},
{
"identity" : "cwlcatchexception",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -63,6 +72,33 @@
"version" : "2.5.3"
}
},
{
"identity" : "swiftgenplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftGen/SwiftGenPlugin",
"state" : {
"revision" : "879b85a470cacd70c19e22eb7e11a3aed66f4068",
"version" : "6.6.2"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms",
"state" : {
"revision" : "b14b7f4c528c942f121c8b860b9410b2bf57825e",
"version" : "1.0.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "wormholy",
"kind" : "remoteSourceControl",
Expand Down
6 changes: 5 additions & 1 deletion CryptoPrices/Sources/Home/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ let package = Package(
.package(name: "Domain", path: "../Domain"),
.package(name: "TestHelpers", path: "../TestHelpers"),
.package(url: "https://github.com/Quick/Quick", from: "6.1.0"),
.package(url: "https://github.com/Quick/Nimble", from: "11.2.1")
.package(url: "https://github.com/Quick/Nimble", from: "11.2.1"),
.package(url: "https://github.com/SwiftGen/SwiftGenPlugin", from: "6.6.2")
],
targets: [
.target(
Expand All @@ -27,6 +28,9 @@ let package = Package(
.product(name: "Styleguide", package: "Styleguide"),
.product(name: "UseCaseProtocol", package: "Domain"),
.product(name: "DomainTestHelpers", package: "Domain")
],
plugins: [
.plugin(name: "SwiftGenPlugin", package: "SwiftGenPlugin")
]
),
.testTarget(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// HomeHeader.swift
// Home
//
// Created by Doan Thieu on 05/01/2023.
//

import Styleguide
import SwiftUI

struct HomeHeader: View {

let title: String
let actionTitle: String
let action: () -> Void

var body: some View {
HStack {
Text(title)
.foregroundColor(Colors.titleMedium.swiftUIColor)
.font(Fonts.Inter.medium.textStyle(.callout))

Spacer()

Button(actionTitle, action: action)
.buttonStyle(.borderless)
.foregroundColor(Colors.caribbeanGreen.swiftUIColor)
.font(Fonts.Inter.medium.textStyle(.subheadline))
}
.padding(16.0)
}
}
36 changes: 36 additions & 0 deletions CryptoPrices/Sources/Home/Sources/Home/CommonViews/Section.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// swiftlint:disable type_contents_order
//
// Section.swift
// Home
//
// Created by Doan Thieu on 06/01/2023.
//

import Styleguide
import SwiftUI

struct Section<Content, Header>: View where Content: View, Header: View {

private let content: Content
private let header: Header?

init(@ViewBuilder content: () -> Content) where Header == EmptyView {
self.content = content()
self.header = nil
}

init(@ViewBuilder content: () -> Content, @ViewBuilder header: () -> Header) {
self.content = content()
self.header = header()
}

var body: some View {
VStack(spacing: 0.0) {
header
content
}
.listRowSeparator(.hidden)
.listRowBackground(Colors.bgMain.swiftUIColor)
.listRowInsets(.init(top: 0.0, leading: 0.0, bottom: 16.0, trailing: 0.0))
}
}
70 changes: 52 additions & 18 deletions CryptoPrices/Sources/Home/Sources/Home/HomeView/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ import SwiftUI
public struct HomeView: View {

public var body: some View {
ScrollView {
VStack(spacing: 40.0) {
headerView
WalletStatisticSection()
MyCoinSection(coins: viewModel.myCoins)
if !viewModel.trendingCoins.isEmpty {
TrendingCoinSection(coins: viewModel.trendingCoins)
}
}
List {
headerSection

myCoinsSection
.renderIf(!viewModel.myCoins.isEmpty)

trendingCoinsSection
.renderIf(!viewModel.trendingCoins.isEmpty)
}
.padding(.top, 24.0)
.clipped(antialiased: false)
.frame(maxHeight: .infinity)
.listStyle(.plain)
.background(Colors.bgMain.swiftUIColor)
.safeAreaInset(edge: .top, spacing: 0.0, content: {
EmptyView()
.frame(height: 1.0)
.background(Colors.bgMain.swiftUIColor)
})
.task {
await viewModel.fetchMyCoins()
await viewModel.fetchTrendingCoins()
await viewModel.fetchAllData()
}
.refreshable {
await viewModel.fetchAllData()
}
}

Expand All @@ -40,10 +44,40 @@ public struct HomeView: View {

private extension HomeView {

var headerView: some View {
Text(Strings.Home.Title.text)
.multilineTextAlignment(.center)
.font(Fonts.Inter.bold.textStyle(.title))
var headerSection: some View {
Section {
Text(Strings.Home.Title.text)
.multilineTextAlignment(.center)
.font(Fonts.Inter.semiBold.textStyle(.title))
.padding(.top, 24.0)
.padding(.bottom, 40.0)

WalletStatisticView()
}
}

var myCoinsSection: some View {
Section {
MyCoinsView(coins: viewModel.myCoins)
} header: {
HomeHeader(
title: Strings.Home.MyCoins.title,
actionTitle: Strings.Home.SeeAll.text,
action: {}
)
}
}

var trendingCoinsSection: some View {
Section {
TrendingCoinsView(coins: viewModel.trendingCoins)
} header: {
HomeHeader(
title: Strings.Home.TrendingCoins.title,
actionTitle: Strings.Home.SeeAll.text,
action: {}
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ import UseCaseProtocol
// TODO: Handle errors
}
}

public func fetchAllData() async {
// Make `fetchMyCoins` and `fetchTrendingCoins` run in parallel
await withTaskGroup(of: Void.self) { taskGroup in
taskGroup.addTask { await self.fetchMyCoins() }
taskGroup.addTask { await self.fetchTrendingCoins() }
}
}
}
63 changes: 0 additions & 63 deletions CryptoPrices/Sources/Home/Sources/Home/Localization/Strings.swift

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8f21688

Please sign in to comment.