Skip to content

Commit

Permalink
Merge pull request #1 from ramyaimansabry/feature/uikit-version
Browse files Browse the repository at this point in the history
Feature/uikit version
  • Loading branch information
ramysabryali authored Apr 4, 2022
2 parents 99c74a8 + 6805383 commit cbaaed5
Show file tree
Hide file tree
Showing 264 changed files with 26,979 additions and 183 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

ADVA Photos Task.xcodeproj/project.xcworkspace/xcuserdata/ramysabry.xcuserdatad/UserInterfaceState.xcuserstate
ADVA Photos Task.xcworkspace/xcuserdata/ramysabry.xcuserdatad/UserInterfaceState.xcuserstate
*.xcuserstate
57 changes: 57 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

disabled_rules: # rule identifiers to exclude from running
- force_cast
- notification_center_detachment
- trailing_whitespace
- unused_closure_parameter


opt_in_rules:
- empty_count

#Customized Rules
line_length:
warning: 250
error: 300
ignores_function_declarations: true
ignores_comments: true
ignores_urls: true


file_length:
warning: 1000
error: 1500
ignore_comment_only_lines: true

type_body_length:
warning: 300
error: 500

function_body_length:
warning: 300
error: 500

function_parameter_count:
warning: 10
error: 11

cyclomatic_complexity:
warning: 15
error: 25

vertical_whitespace:
warning: 3
max_empty_lines: 2

identifier_name:
min_length: 2



excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
- Carthage
- SwiftLint/Common/3rdPartyLib
- Fructus/Data/FruitData.swift

reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)
881 changes: 851 additions & 30 deletions ADVA Photos Task.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "193C4103-84E7-41B5-8011-96B2C5F53E2C"
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>ADVA Photos Task.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>3</integer>
</dict>
</dict>
</dict>
Expand Down
10 changes: 10 additions & 0 deletions ADVA Photos Task.xcworkspace/contents.xcworkspacedata

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "5EB738FE-AAD3-4FB9-9038-5FDF723B3378"
type = "0"
version = "2.0">
</Bucket>
36 changes: 0 additions & 36 deletions ADVA Photos Task/AppDelegate.swift

This file was deleted.

32 changes: 32 additions & 0 deletions ADVA Photos Task/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// AppDelegate.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 28/03/2022.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
private var coordinator: Coordinator?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

// create the main navigation controller to be used for our app
let navigationController = UINavigationController()

// send that into our coordinator so that it can display view controllers
coordinator = AppCoordinator(navigationController: navigationController)

// tell the coordinator to take over control
coordinator?.start()

window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
return true
}
}
24 changes: 0 additions & 24 deletions ADVA Photos Task/Base.lproj/Main.storyboard

This file was deleted.

10 changes: 10 additions & 0 deletions ADVA Photos Task/Configurations/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SERVER_HOST</key>
<string>$(SERVER_HOST)</string>
<key>SERVER_SCHEME</key>
<string>$(SERVER_SCHEME)</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// HomeRepository.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 30/03/2022.
//

import Combine

final class HomeRepository: DisposeObject, HomeRepositoryContract {
private let service: HomeServiceContract

init(service: HomeServiceContract = HomeService()) {
self.service = service
super.init()
}

func fetchPhotosList(
with pageIndex: Int,
and pageSize: Int
) -> AnyPublisher<[PhotoData], BaseError> {
return service.fetchphotosList(with: pageIndex, and: pageSize)
.eraseToBaseError()
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// HomeService.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 30/03/2022.
//

import Combine

final class HomeService: DisposeObject, HomeServiceContract {
private var apiService: APIServiceContract

init(apiService: APIServiceContract = APIService.shared) {
self.apiService = apiService
super.init()
}

func fetchphotosList(
with pageIndex: Int,
and pageSize: Int
) -> AnyPublisher<[PhotoData], BaseError> {
let request = APIBuilder()
.setPath(using: .fetchPhotosList, argument: ["\(pageIndex)", "\(pageSize)"])
.setMethod(using: .get)
.build()

return apiService
.request(
using: request,
responseType: [PhotoData].self
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// HomeRepositoryContract.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 30/03/2022.
//

import Combine

protocol HomeRepositoryContract {
func fetchPhotosList(
with pageIndex: Int,
and pageSize: Int
) -> AnyPublisher<[PhotoData], BaseError>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// HomeServiceContract.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 30/03/2022.
//

import Combine

protocol HomeServiceContract {
func fetchphotosList(
with pageIndex: Int,
and pageSize: Int
) -> AnyPublisher<[PhotoData], BaseError>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// FetchPhotosListUseCaseUseCaseContract.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 30/03/2022.
//

import Combine

protocol FetchPhotosListUseCaseContract {
func execute(
with pageIndex: Int,
and pageSize: Int
) -> AnyPublisher<[PhotoData], BaseError>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// HomeViewModelContract.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 30/03/2022.
//

import Foundation

typealias HomeViewModelContract = BaseViewModel & ObservableObject & HomeViewModelInput & HomeViewModelOutput

protocol HomeViewModelInput {
func loadPhotos()
func loadMorePhotos()
}

protocol HomeViewModelOutput {
func getPhotoData(for indexPath: IndexPath) -> PhotoData?
func getPhotoSize(for indexPath: IndexPath) -> (Float, Float)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// PhotosListResponse.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 30/03/2022.
//

import Foundation

struct PhotoData: Decodable {
let id: String
let createdAt: String?
let updatedAt: String?
let promotedAt: String?
let width: Float?
let height: Float?
let color: String?
let blurHash: String?
let welcomeDescription: String?
let altDescription: String?
let urls: PhotoURLs?
let links: PhotoDownloadLinks?
let likes: Int?
let likedByUser: Bool?
let sponsorship: PhotoSponsorship?
let user: PhotoOwner?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// PhotoDownloadLinks.swift
// ADVA Photos Task
//
// Created by Ramy Sabry on 03/04/2022.
//

import Foundation

struct PhotoDownloadLinks: Decodable {
let linksSelf: String?
let html: String?
let download: String?
let downloadLocation: String?
}
Loading

0 comments on commit cbaaed5

Please sign in to comment.