Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
watery-desert committed Feb 10, 2022
1 parent 93ea294 commit c48a514
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 40 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@
</table>


## Known issue

AsyncImage has an issue loading image
https://developer.apple.com/forums/thread/682498
if you don't want to see the error then

Replace this 👇

```swift
Image(systemName: "exclamationmark.triangle")
.padding()
.font(.largeTitle)
```
with this 👇

```swift
EmptyView()
```



## Illustration Credit

Expand Down
12 changes: 4 additions & 8 deletions UnsplashPhotosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
E23BCD6127A994790072C847 /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E23BCD4B27A994790072C847 /* ErrorView.swift */; };
E23BCD6227A994790072C847 /* RecentPhotosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E23BCD4D27A994790072C847 /* RecentPhotosView.swift */; };
E23BCD6327A994790072C847 /* TopicRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E23BCD4E27A994790072C847 /* TopicRow.swift */; };
E2B46C2727AA096F006A747B /* PhotosService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B46C2627AA096F006A747B /* PhotosService.swift */; };
E2B46C2B27AA0EB0006A747B /* PhotoService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B46C2A27AA0EB0006A747B /* PhotoService.swift */; };
E2B46C2B27AA0EB0006A747B /* APIService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B46C2A27AA0EB0006A747B /* APIService.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -63,8 +62,7 @@
E23BCD4E27A994790072C847 /* TopicRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopicRow.swift; sourceTree = "<group>"; };
E23BCD6527A996310072C847 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
E23BCD6627A9999B0072C847 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
E2B46C2627AA096F006A747B /* PhotosService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotosService.swift; sourceTree = "<group>"; };
E2B46C2A27AA0EB0006A747B /* PhotoService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoService.swift; sourceTree = "<group>"; };
E2B46C2A27AA0EB0006A747B /* APIService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIService.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -211,8 +209,7 @@
E23BCD6727A9A7ED0072C847 /* Services */ = {
isa = PBXGroup;
children = (
E2B46C2627AA096F006A747B /* PhotosService.swift */,
E2B46C2A27AA0EB0006A747B /* PhotoService.swift */,
E2B46C2A27AA0EB0006A747B /* APIService.swift */,
);
path = Services;
sourceTree = "<group>";
Expand Down Expand Up @@ -296,12 +293,11 @@
E23BCD5227A994790072C847 /* SearchPhotoViewModel.swift in Sources */,
E23BCD5F27A994790072C847 /* StaggeredPhotosView.swift in Sources */,
E23BCD5727A994790072C847 /* Urls.swift in Sources */,
E2B46C2727AA096F006A747B /* PhotosService.swift in Sources */,
E23BCD5E27A994790072C847 /* PhotoTile.swift in Sources */,
E23BCD5027A994790072C847 /* DownloadPhotoViewModel.swift in Sources */,
E23BCD6327A994790072C847 /* TopicRow.swift in Sources */,
E23BCD4F27A994790072C847 /* TopicViewModel.swift in Sources */,
E2B46C2B27AA0EB0006A747B /* PhotoService.swift in Sources */,
E2B46C2B27AA0EB0006A747B /* APIService.swift in Sources */,
E23BCD5927A994790072C847 /* Extensions.swift in Sources */,
E23BCD6027A994790072C847 /* LoadingView.swift in Sources */,
E23BCD2527A994360072C847 /* UnsplashPhotosAppApp.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// PhotoService.swift
// APIService.swift
// UnsplashPhotosApp
//
// Created by Ahmed on 02/02/22.
Expand All @@ -8,7 +8,7 @@
import Foundation
import Combine

class PhotoService<T: Codable> {
class APIService<T: Codable> {
let url: URL

init(_ url :URL) {
Expand Down
26 changes: 0 additions & 26 deletions UnsplashPhotosApp/Source/Services/PhotosService.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DownloadPhotoViewModel: ObservableObject {
return
}

let photoService = PhotoService<DownloadPhoto>(url)
let photoService = APIService<DownloadPhoto>(url)

photoService.getData()
.sink { [weak self] completion in
Expand Down
2 changes: 1 addition & 1 deletion UnsplashPhotosApp/Source/ViewModels/PhotoViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PhotoViewModel : ObservableObject {
return
}

let photosService = PhotosService<Photo>(url)
let photosService = APIService<[Photo]>(url)

photosService.getData()
.delay(for: 0.8, scheduler: RunLoop.main)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SearchPhotoViewModel : ObservableObject {
state = .failed(URLError(URLError.badURL))
return
}
let photoService = PhotoService<QueryPhoto>(url)
let photoService = APIService<QueryPhoto>(url)

photoService.getData()
.sink { [weak self] completion in
Expand Down
2 changes: 1 addition & 1 deletion UnsplashPhotosApp/Source/ViewModels/TopicViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TopicViewModel: ObservableObject {
return
}

let photosService = PhotosService<Topic>(url)
let photosService = APIService<[Topic]>(url)

photosService.getData()
.sink { [weak self] completion in
Expand Down

0 comments on commit c48a514

Please sign in to comment.