aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--foray.xcodeproj/project.pbxproj48
-rw-r--r--foray/Fetchers/ForayFetcher.swift (renamed from foray/ForayNetworkManager.swift)4
-rw-r--r--foray/Models/PenguinItemModel.swift (renamed from foray/ForayModels.swift)0
-rw-r--r--foray/Models/PenguinItemViewModel.swift (renamed from foray/ForayViewModels.swift)0
-rw-r--r--foray/Presenters/PenguinItemPresenter.swift18
5 files changed, 43 insertions, 27 deletions
diff --git a/foray.xcodeproj/project.pbxproj b/foray.xcodeproj/project.pbxproj
index 176b21c..0480143 100644
--- a/foray.xcodeproj/project.pbxproj
+++ b/foray.xcodeproj/project.pbxproj
@@ -7,8 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
- C011E4F127E6211400C248D6 /* ForayNetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C011E4F027E6211400C248D6 /* ForayNetworkManager.swift */; };
- C011E4F327E6216C00C248D6 /* ForayModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = C011E4F227E6216C00C248D6 /* ForayModels.swift */; };
+ C011E4F127E6211400C248D6 /* ForayFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C011E4F027E6211400C248D6 /* ForayFetcher.swift */; };
+ C011E4F327E6216C00C248D6 /* PenguinItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C011E4F227E6216C00C248D6 /* PenguinItemModel.swift */; };
C049BBFE27E82B9E003820A9 /* Coordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C049BBFD27E82B9E003820A9 /* Coordinator.swift */; };
C049BC0027E82C90003820A9 /* ForayCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C049BBFF27E82C90003820A9 /* ForayCoordinator.swift */; };
C04B45A427DEF117001451A3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04B45A327DEF117001451A3 /* AppDelegate.swift */; };
@@ -20,14 +20,14 @@
C09676BA27E86B6E00353D46 /* ForayLoadingOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = C09676B927E86B6E00353D46 /* ForayLoadingOverlay.swift */; };
C09676BC27EC27E700353D46 /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C09676BB27EC27E700353D46 /* UIViewController+Extensions.swift */; };
C09676BE27EC28B100353D46 /* ForayDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C09676BD27EC28B100353D46 /* ForayDetailView.swift */; };
- C0C73E6427EC3A650015497D /* ForayViewModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0C73E6327EC3A650015497D /* ForayViewModels.swift */; };
+ C0C73E6427EC3A650015497D /* PenguinItemViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0C73E6327EC3A650015497D /* PenguinItemViewModel.swift */; };
C0C73E6727EC3BA50015497D /* PenguinItemPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0C73E6627EC3BA50015497D /* PenguinItemPresenter.swift */; };
C0FEAF5F27E14C52000A7648 /* ForayDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0FEAF5E27E14C52000A7648 /* ForayDetailViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
- C011E4F027E6211400C248D6 /* ForayNetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayNetworkManager.swift; sourceTree = "<group>"; };
- C011E4F227E6216C00C248D6 /* ForayModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayModels.swift; sourceTree = "<group>"; };
+ C011E4F027E6211400C248D6 /* ForayFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayFetcher.swift; sourceTree = "<group>"; };
+ C011E4F227E6216C00C248D6 /* PenguinItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PenguinItemModel.swift; sourceTree = "<group>"; };
C049BBFD27E82B9E003820A9 /* Coordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coordinator.swift; sourceTree = "<group>"; };
C049BBFF27E82C90003820A9 /* ForayCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayCoordinator.swift; sourceTree = "<group>"; };
C04B45A027DEF117001451A3 /* foray.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = foray.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -40,7 +40,7 @@
C09676B927E86B6E00353D46 /* ForayLoadingOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayLoadingOverlay.swift; sourceTree = "<group>"; };
C09676BB27EC27E700353D46 /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extensions.swift"; sourceTree = "<group>"; };
C09676BD27EC28B100353D46 /* ForayDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayDetailView.swift; sourceTree = "<group>"; };
- C0C73E6327EC3A650015497D /* ForayViewModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayViewModels.swift; sourceTree = "<group>"; };
+ C0C73E6327EC3A650015497D /* PenguinItemViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PenguinItemViewModel.swift; sourceTree = "<group>"; };
C0C73E6627EC3BA50015497D /* PenguinItemPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PenguinItemPresenter.swift; sourceTree = "<group>"; };
C0FEAF5E27E14C52000A7648 /* ForayDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayDetailViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -76,17 +76,16 @@
C04B45A227DEF117001451A3 /* foray */ = {
isa = PBXGroup;
children = (
- C0C73E6527EC3B8F0015497D /* Presenters */,
- C09676C327EC358F00353D46 /* Coordinators */,
- C09676C227EC354700353D46 /* Extensions */,
- C09676C127EC353D00353D46 /* Scenes */,
C04B45A327DEF117001451A3 /* AppDelegate.swift */,
C04B45A527DEF117001451A3 /* SceneDelegate.swift */,
- C011E4F227E6216C00C248D6 /* ForayModels.swift */,
- C0C73E6327EC3A650015497D /* ForayViewModels.swift */,
- C011E4F027E6211400C248D6 /* ForayNetworkManager.swift */,
C04B45AC27DEF118001451A3 /* Assets.xcassets */,
C04B45B127DEF118001451A3 /* Info.plist */,
+ C0C73E6827ED2F0A0015497D /* Models */,
+ C0C73E6527EC3B8F0015497D /* Presenters */,
+ C09676C327EC358F00353D46 /* Coordinators */,
+ C09676C227EC354700353D46 /* Extensions */,
+ C09676C127EC353D00353D46 /* Scenes */,
+ C0C73E6927ED2F2D0015497D /* Fetchers */,
);
path = foray;
sourceTree = "<group>";
@@ -128,6 +127,23 @@
path = Presenters;
sourceTree = "<group>";
};
+ C0C73E6827ED2F0A0015497D /* Models */ = {
+ isa = PBXGroup;
+ children = (
+ C011E4F227E6216C00C248D6 /* PenguinItemModel.swift */,
+ C0C73E6327EC3A650015497D /* PenguinItemViewModel.swift */,
+ );
+ path = Models;
+ sourceTree = "<group>";
+ };
+ C0C73E6927ED2F2D0015497D /* Fetchers */ = {
+ isa = PBXGroup;
+ children = (
+ C011E4F027E6211400C248D6 /* ForayFetcher.swift */,
+ );
+ path = Fetchers;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -204,17 +220,17 @@
buildActionMask = 2147483647;
files = (
C049BBFE27E82B9E003820A9 /* Coordinator.swift in Sources */,
- C011E4F127E6211400C248D6 /* ForayNetworkManager.swift in Sources */,
+ C011E4F127E6211400C248D6 /* ForayFetcher.swift in Sources */,
C049BC0027E82C90003820A9 /* ForayCoordinator.swift in Sources */,
C09676BE27EC28B100353D46 /* ForayDetailView.swift in Sources */,
C04B45B827DEF2ED001451A3 /* ForayTableViewController.swift in Sources */,
C0FEAF5F27E14C52000A7648 /* ForayDetailViewController.swift in Sources */,
- C0C73E6427EC3A650015497D /* ForayViewModels.swift in Sources */,
+ C0C73E6427EC3A650015497D /* PenguinItemViewModel.swift in Sources */,
C04EDE4427E4298D00D83005 /* ForayNewTableViewCell.swift in Sources */,
C09676BC27EC27E700353D46 /* UIViewController+Extensions.swift in Sources */,
C04B45A427DEF117001451A3 /* AppDelegate.swift in Sources */,
C09676BA27E86B6E00353D46 /* ForayLoadingOverlay.swift in Sources */,
- C011E4F327E6216C00C248D6 /* ForayModels.swift in Sources */,
+ C011E4F327E6216C00C248D6 /* PenguinItemModel.swift in Sources */,
C0C73E6727EC3BA50015497D /* PenguinItemPresenter.swift in Sources */,
C04B45A627DEF117001451A3 /* SceneDelegate.swift in Sources */,
);
diff --git a/foray/ForayNetworkManager.swift b/foray/Fetchers/ForayFetcher.swift
index 53e9554..d8df037 100644
--- a/foray/ForayNetworkManager.swift
+++ b/foray/Fetchers/ForayFetcher.swift
@@ -7,9 +7,7 @@
import Foundation
-class ForayNetworkManager {
- static let shared = ForayNetworkManager()
-
+class ForayFetcher {
var basicUsername: String? = nil
var basicPassword: String? = nil
diff --git a/foray/ForayModels.swift b/foray/Models/PenguinItemModel.swift
index c721b95..c721b95 100644
--- a/foray/ForayModels.swift
+++ b/foray/Models/PenguinItemModel.swift
diff --git a/foray/ForayViewModels.swift b/foray/Models/PenguinItemViewModel.swift
index 9b9b058..9b9b058 100644
--- a/foray/ForayViewModels.swift
+++ b/foray/Models/PenguinItemViewModel.swift
diff --git a/foray/Presenters/PenguinItemPresenter.swift b/foray/Presenters/PenguinItemPresenter.swift
index 2f3730f..698b56e 100644
--- a/foray/Presenters/PenguinItemPresenter.swift
+++ b/foray/Presenters/PenguinItemPresenter.swift
@@ -8,16 +8,18 @@
import Foundation
class PenguinItemPresenter {
+
+ let fetcher = ForayFetcher()
+
func fetch(receiver: @escaping ([PenguinItemViewModel]) -> ()) {
- ForayNetworkManager.shared
- .fetch(url: "https://users.windblume.net/~nick/upload/dummy.json") { (apiItems: [PenguinItemModel]) in
- // Callback to main thread here
- // There probably is a nicer way to do it, but we will DispatchQueue it back
- // from the Presenter-level for now (main thread from VC onwards)
- DispatchQueue.main.async {
- receiver(self.transform(models: apiItems))
- }
+ fetcher.fetch(url: "https://users.windblume.net/~nick/upload/dummy.json") { (apiItems: [PenguinItemModel]) in
+ // Callback to main thread here
+ // There probably is a nicer way to do it, but we will DispatchQueue it back
+ // from the Presenter-level for now (main thread from VC onwards)
+ DispatchQueue.main.async {
+ receiver(self.transform(models: apiItems))
}
+ }
}
func transform(models: [PenguinItemModel]) -> [PenguinItemViewModel] {