Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 142 additions & 6 deletions TakeHomeApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
3D8BD83F28744BEC004FCCF8 /* PlacesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD83E28744BEC004FCCF8 /* PlacesViewModel.swift */; };
3D8BD84128744CC3004FCCF8 /* Place.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD84028744CC3004FCCF8 /* Place.swift */; };
3D8BD84328776029004FCCF8 /* PlaceTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD84228776029004FCCF8 /* PlaceTableViewCell.swift */; };
3D8BD84528776049004FCCF8 /* Reusable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD84428776049004FCCF8 /* Reusable.swift */; };
3D8BD848287760C3004FCCF8 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 3D8BD847287760C3004FCCF8 /* SnapKit */; };
3D8BD84B287760D1004FCCF8 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 3D8BD84A287760D1004FCCF8 /* Kingfisher */; };
3D8BD84F287762DE004FCCF8 /* PlaceTableViewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD84E287762DE004FCCF8 /* PlaceTableViewViewModel.swift */; };
3D8BD85128789E29004FCCF8 /* Endpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD85028789E29004FCCF8 /* Endpoint.swift */; };
3D8BD85428789FCC004FCCF8 /* PhotosViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD85328789FCC004FCCF8 /* PhotosViewController.swift */; };
3D8BD8562878A00B004FCCF8 /* PhotosViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD8552878A00B004FCCF8 /* PhotosViewModel.swift */; };
3D8BD8582878A02B004FCCF8 /* PhotoCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD8572878A02B004FCCF8 /* PhotoCollectionViewCell.swift */; };
3D8BD85B2878AC2F004FCCF8 /* Photo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD85A2878AC2F004FCCF8 /* Photo.swift */; };
3D8BD85D2878ACD7004FCCF8 /* PhotoCollectionViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BD85C2878ACD7004FCCF8 /* PhotoCollectionViewCellViewModel.swift */; };
AF8DA7D02639E4AB0011F652 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF8DA7CF2639E4AB0011F652 /* AppDelegate.swift */; };
AF8DA7D42639E4AB0011F652 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF8DA7D32639E4AB0011F652 /* ViewController.swift */; };
AF8DA7D42639E4AB0011F652 /* PlacesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF8DA7D32639E4AB0011F652 /* PlacesViewController.swift */; };
AF8DA7D92639E4AE0011F652 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AF8DA7D82639E4AE0011F652 /* Assets.xcassets */; };
AF8DA7DC2639E4AE0011F652 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF8DA7DA2639E4AE0011F652 /* LaunchScreen.storyboard */; };
AF8DA7E72639E4AE0011F652 /* TakeHomeAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF8DA7E62639E4AE0011F652 /* TakeHomeAppTests.swift */; };
Expand All @@ -34,9 +47,20 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3D8BD83E28744BEC004FCCF8 /* PlacesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlacesViewModel.swift; sourceTree = "<group>"; };
3D8BD84028744CC3004FCCF8 /* Place.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Place.swift; sourceTree = "<group>"; };
3D8BD84228776029004FCCF8 /* PlaceTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceTableViewCell.swift; sourceTree = "<group>"; };
3D8BD84428776049004FCCF8 /* Reusable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reusable.swift; sourceTree = "<group>"; };
3D8BD84E287762DE004FCCF8 /* PlaceTableViewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceTableViewViewModel.swift; sourceTree = "<group>"; };
3D8BD85028789E29004FCCF8 /* Endpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Endpoint.swift; sourceTree = "<group>"; };
3D8BD85328789FCC004FCCF8 /* PhotosViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotosViewController.swift; sourceTree = "<group>"; };
3D8BD8552878A00B004FCCF8 /* PhotosViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotosViewModel.swift; sourceTree = "<group>"; };
3D8BD8572878A02B004FCCF8 /* PhotoCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoCollectionViewCell.swift; sourceTree = "<group>"; };
3D8BD85A2878AC2F004FCCF8 /* Photo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Photo.swift; sourceTree = "<group>"; };
3D8BD85C2878ACD7004FCCF8 /* PhotoCollectionViewCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoCollectionViewCellViewModel.swift; sourceTree = "<group>"; };
AF8DA7CC2639E4AB0011F652 /* TakeHomeApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TakeHomeApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
AF8DA7CF2639E4AB0011F652 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
AF8DA7D32639E4AB0011F652 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
AF8DA7D32639E4AB0011F652 /* PlacesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlacesViewController.swift; sourceTree = "<group>"; };
AF8DA7D82639E4AE0011F652 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
AF8DA7DB2639E4AE0011F652 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
AF8DA7DD2639E4AE0011F652 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -54,6 +78,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3D8BD84B287760D1004FCCF8 /* Kingfisher in Frameworks */,
3D8BD848287760C3004FCCF8 /* SnapKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -74,6 +100,66 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
3D8BD83C28744BA5004FCCF8 /* Sources */ = {
isa = PBXGroup;
children = (
3D8BD85228789F66004FCCF8 /* PhotosList */,
3D8BD84D287762C3004FCCF8 /* PlacesList */,
3D8BD83D28744BBE004FCCF8 /* Model */,
AF8DA7CF2639E4AB0011F652 /* AppDelegate.swift */,
3D8BD84428776049004FCCF8 /* Reusable.swift */,
3D8BD85028789E29004FCCF8 /* Endpoint.swift */,
);
path = Sources;
sourceTree = "<group>";
};
3D8BD83D28744BBE004FCCF8 /* Model */ = {
isa = PBXGroup;
children = (
3D8BD84028744CC3004FCCF8 /* Place.swift */,
3D8BD85A2878AC2F004FCCF8 /* Photo.swift */,
);
path = Model;
sourceTree = "<group>";
};
3D8BD84C287762B3004FCCF8 /* PlaceCell */ = {
isa = PBXGroup;
children = (
3D8BD84228776029004FCCF8 /* PlaceTableViewCell.swift */,
3D8BD84E287762DE004FCCF8 /* PlaceTableViewViewModel.swift */,
);
path = PlaceCell;
sourceTree = "<group>";
};
3D8BD84D287762C3004FCCF8 /* PlacesList */ = {
isa = PBXGroup;
children = (
3D8BD84C287762B3004FCCF8 /* PlaceCell */,
3D8BD83E28744BEC004FCCF8 /* PlacesViewModel.swift */,
AF8DA7D32639E4AB0011F652 /* PlacesViewController.swift */,
);
path = PlacesList;
sourceTree = "<group>";
};
3D8BD85228789F66004FCCF8 /* PhotosList */ = {
isa = PBXGroup;
children = (
3D8BD8592878A04E004FCCF8 /* PhotoCell */,
3D8BD85328789FCC004FCCF8 /* PhotosViewController.swift */,
3D8BD8552878A00B004FCCF8 /* PhotosViewModel.swift */,
);
path = PhotosList;
sourceTree = "<group>";
};
3D8BD8592878A04E004FCCF8 /* PhotoCell */ = {
isa = PBXGroup;
children = (
3D8BD8572878A02B004FCCF8 /* PhotoCollectionViewCell.swift */,
3D8BD85C2878ACD7004FCCF8 /* PhotoCollectionViewCellViewModel.swift */,
);
path = PhotoCell;
sourceTree = "<group>";
};
AF8DA7C32639E4AB0011F652 = {
isa = PBXGroup;
children = (
Expand All @@ -98,8 +184,7 @@
AF8DA7CE2639E4AB0011F652 /* TakeHomeApp */ = {
isa = PBXGroup;
children = (
AF8DA7CF2639E4AB0011F652 /* AppDelegate.swift */,
AF8DA7D32639E4AB0011F652 /* ViewController.swift */,
3D8BD83C28744BA5004FCCF8 /* Sources */,
AF8DA7D82639E4AE0011F652 /* Assets.xcassets */,
AF8DA7DA2639E4AE0011F652 /* LaunchScreen.storyboard */,
AF8DA7DD2639E4AE0011F652 /* Info.plist */,
Expand Down Expand Up @@ -141,6 +226,10 @@
dependencies = (
);
name = TakeHomeApp;
packageProductDependencies = (
3D8BD847287760C3004FCCF8 /* SnapKit */,
3D8BD84A287760D1004FCCF8 /* Kingfisher */,
);
productName = TakeHomeApp;
productReference = AF8DA7CC2639E4AB0011F652 /* TakeHomeApp.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -212,6 +301,10 @@
Base,
);
mainGroup = AF8DA7C32639E4AB0011F652;
packageReferences = (
3D8BD846287760C3004FCCF8 /* XCRemoteSwiftPackageReference "SnapKit" */,
3D8BD849287760D1004FCCF8 /* XCRemoteSwiftPackageReference "Kingfisher" */,
);
productRefGroup = AF8DA7CD2639E4AB0011F652 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -255,8 +348,19 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AF8DA7D42639E4AB0011F652 /* ViewController.swift in Sources */,
3D8BD85B2878AC2F004FCCF8 /* Photo.swift in Sources */,
3D8BD85428789FCC004FCCF8 /* PhotosViewController.swift in Sources */,
3D8BD84528776049004FCCF8 /* Reusable.swift in Sources */,
3D8BD84F287762DE004FCCF8 /* PlaceTableViewViewModel.swift in Sources */,
3D8BD85128789E29004FCCF8 /* Endpoint.swift in Sources */,
3D8BD83F28744BEC004FCCF8 /* PlacesViewModel.swift in Sources */,
AF8DA7D42639E4AB0011F652 /* PlacesViewController.swift in Sources */,
3D8BD85D2878ACD7004FCCF8 /* PhotoCollectionViewCellViewModel.swift in Sources */,
AF8DA7D02639E4AB0011F652 /* AppDelegate.swift in Sources */,
3D8BD8562878A00B004FCCF8 /* PhotosViewModel.swift in Sources */,
3D8BD84128744CC3004FCCF8 /* Place.swift in Sources */,
3D8BD8582878A02B004FCCF8 /* PhotoCollectionViewCell.swift in Sources */,
3D8BD84328776029004FCCF8 /* PlaceTableViewCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -575,6 +679,38 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
3D8BD846287760C3004FCCF8 /* XCRemoteSwiftPackageReference "SnapKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SnapKit/SnapKit.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 5.0.0;
};
};
3D8BD849287760D1004FCCF8 /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/onevcat/Kingfisher.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 7.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
3D8BD847287760C3004FCCF8 /* SnapKit */ = {
isa = XCSwiftPackageProductDependency;
package = 3D8BD846287760C3004FCCF8 /* XCRemoteSwiftPackageReference "SnapKit" */;
productName = SnapKit;
};
3D8BD84A287760D1004FCCF8 /* Kingfisher */ = {
isa = XCSwiftPackageProductDependency;
package = 3D8BD849287760D1004FCCF8 /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = AF8DA7C42639E4AB0011F652 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions TakeHomeApp/Assets.xcassets/placeholder.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "placeholder-images-image_large.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = ViewController()
let navigationController = UINavigationController(rootViewController: PlacesViewController())
window.rootViewController = navigationController
window.makeKeyAndVisible()

self.window = window
Expand Down
14 changes: 14 additions & 0 deletions TakeHomeApp/Sources/Endpoint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Endpoint.swift
// TakeHomeApp
//
// Created by Silvia Kuzmova on 08.07.22.
//

import Foundation

enum Endpoint {

static let mainURLString = "https://608948878c8043001757e68c.mockapi.io/api/v1"

}
37 changes: 37 additions & 0 deletions TakeHomeApp/Sources/Model/Photo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Photo.swift
// TakeHomeApp
//
// Created by Silvia Kuzmova on 08.07.22.
//

import Foundation

struct Photo {
let id: String
let placeId: String
let createdAt: Date
let imageURL: URL?
}

extension Photo: Decodable {

init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decode(String.self, forKey: .id)
placeId = try container.decode(String.self, forKey: .placeId)
let createdAtString = try container.decode(String.self, forKey: .createdAt)
let dateFormatter = ISO8601DateFormatter() // todo
createdAt = dateFormatter.date(from: createdAtString) ?? Date()
let imageURLString = try container.decode(String.self, forKey: .imageURL)
imageURL = URL(string: imageURLString)
}

private enum CodingKeys: String, CodingKey {
case id
case placeId
case createdAt
case imageURL = "image"
}
}

36 changes: 36 additions & 0 deletions TakeHomeApp/Sources/Model/Place.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// Place.swift
// TakeHomeApp
//
// Created by Silvia Kuzmova on 05.07.22.
//

import Foundation

struct Place {
let id: String
let createdAt: Date
let name: String
let thumbnailURL: URL?
}

extension Place: Decodable {

init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decode(String.self, forKey: .id)
name = try container.decode(String.self, forKey: .name)
let createdAtString = try container.decode(String.self, forKey: .createdAt)
let dateFormatter = ISO8601DateFormatter() // todo
createdAt = dateFormatter.date(from: createdAtString) ?? Date()
let thumbnailURLString = try container.decode(String.self, forKey: .thumbnailURL)
thumbnailURL = URL(string: thumbnailURLString)
}

private enum CodingKeys: String, CodingKey {
case id
case createdAt
case name
case thumbnailURL = "thumbnail"
}
}
Loading