Skip to content

add docompositions folder #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
001374d
add docompositions folder
ilyanikitash Mar 13, 2025
cf6ec55
add statistic screen decomposition
ilyanikitash Mar 14, 2025
ac2c1cd
feat: users list UI, Sort alert
ilyanikitash Mar 15, 2025
ebc9e48
feat: add sort
ilyanikitash Mar 15, 2025
ed84ff6
Update statistic-decompositions.md
ilyanikitash Mar 19, 2025
58836e5
feat: logic development/networking
ilyanikitash Mar 19, 2025
2170b2a
Merge branch 'epic/statistics_1' of https://github.com/ilyanikitash/i…
ilyanikitash Mar 19, 2025
29db1fa
Update statistic-decompositions.md
ilyanikitash Mar 19, 2025
d4ef9c8
feat: profile view
ilyanikitash Mar 21, 2025
879bed6
Merge pull request #1 from ilyanikitash/epic/statistics_1
ilyanikitash Mar 23, 2025
9935b76
feat: user screen UI
ilyanikitash Mar 23, 2025
e357208
feat: profile data
ilyanikitash Mar 23, 2025
3939619
feat: activity indicator
ilyanikitash Mar 23, 2025
134faaf
feat: user site opening
ilyanikitash Mar 24, 2025
5fa8f6f
fix: delete unnecessary code
ilyanikitash Mar 24, 2025
4daa846
fix: ui and minor improvements
ilyanikitash Mar 25, 2025
b544672
feat: labeling added
ilyanikitash Mar 25, 2025
5e18b83
feat: add unit tests
ilyanikitash Mar 26, 2025
defab53
Merge pull request #9 from ilyanikitash/epic/statistic_2
ilyanikitash Mar 26, 2025
32e9612
feat: view and view controller init
ilyanikitash Mar 27, 2025
b779592
fix: delete empty file
ilyanikitash Mar 27, 2025
c614aff
Merge branch 'epic/statistics' of https://github.com/ilyanikitash/iOS…
ilyanikitash Mar 27, 2025
354bf4e
feat: collectionView with network, improve ui
ilyanikitash Apr 5, 2025
6087558
feat: empty collection processing
ilyanikitash Apr 5, 2025
85ced20
fix: review changes
ilyanikitash Apr 6, 2025
b9d7a60
Merge pull request #12 from ilyanikitash/epic/statistic_3
ilyanikitash Apr 6, 2025
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
Empty file added Decompositions/.gitkeep
Empty file.
16 changes: 16 additions & 0 deletions Decompositions/statistic-decompositions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Архетектура
MVC
# Способ верски
Верстка кодом
## 1. экран со списком пользователей
верстка (4 часа)
разработка логики/сеть (7 часов)
добавление сортировки (3 часа)
## 2. экран профиля
верстка (3,5 часа)
разработка логики/сеть (6 часов)
## 3. экран коллекции
верстка (3,5 часа)
разработка логики/сеть (6 часов)

# Decomposition board: https://github.com/users/ilyanikitash/projects/2/views/1
174 changes: 169 additions & 5 deletions FakeNFT.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions FakeNFT/DesignSystem/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ extension UIColor {
static let secondary = UIColor(red: 255 / 255, green: 193 / 255, blue: 7 / 255, alpha: 1.0)

// Background Colors
static let background = UIColor.white
private static let backgroundLight = UIColor.white
private static let backgroundDark = UIColor.black

// Text Colors
static let textPrimary = UIColor.black
Expand All @@ -46,7 +47,13 @@ extension UIColor {
private static let yaBlackDark = UIColor.white
private static let yaLightGrayLight = UIColor(hexString: "#F7F7F8")
private static let yaLightGrayDark = UIColor(hexString: "#2C2C2E")


static let background = UIColor { traits in
return traits.userInterfaceStyle == .dark
? .backgroundDark
: .backgroundLight
}

static let segmentActive = UIColor { traits in
return traits.userInterfaceStyle == .dark
? .yaBlackDark
Expand Down
14 changes: 14 additions & 0 deletions FakeNFT/Foundation/SnakeCaseJSONDecoder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// SnakeCaseJSONDecoder.swift
// FakeNFT
//
// Created by Ilya Nikitash on 3/19/25.
//
import Foundation

final class SnakeCaseJSONDecoder: JSONDecoder {
override init() {
super.init()
keyDecodingStrategy = .convertFromSnakeCase
}
}
71 changes: 71 additions & 0 deletions FakeNFT/Foundation/URLSession + data.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// URLSession.swift
// FakeNFT
//
// Created by Ilya Nikitash on 3/19/25.
//
import Foundation


enum NetworkError: Error {
case httpStatusCode(Int)
case urlRequestError(Error)
case urlSessionError
}

extension URLSession {
func data(
for request: URLRequest,
completion: @escaping (Result<Data, Error>) -> Void
) -> URLSessionTask {
let fulfillCompletionOnTheMainThread: (Result<Data, Error>) -> Void = { result in
DispatchQueue.main.async {
completion(result)
}
}

let task = dataTask(with: request, completionHandler: { data, response, error in
if let data = data, let response = response, let statusCode = (response as? HTTPURLResponse)?.statusCode {
if 200 ..< 300 ~= statusCode {
fulfillCompletionOnTheMainThread(.success(data))
} else {
print("[\(String(describing: self)).\(#function)]: \(NetworkError.httpStatusCode(statusCode)) - Network error with status code \(statusCode)")
fulfillCompletionOnTheMainThread(.failure(NetworkError.httpStatusCode(statusCode)))
}
} else if let error = error {
print("[\(String(describing: self)).\(#function)]: \(NetworkError.urlRequestError(error)) - URL request error, \(error.localizedDescription)")
fulfillCompletionOnTheMainThread(.failure(NetworkError.urlRequestError(error)))
} else {
print("[\(String(describing: self)).\(#function)]: \(NetworkError.urlSessionError) - URL session error")
fulfillCompletionOnTheMainThread(.failure(NetworkError.urlSessionError))
}
})

return task
}
}

extension URLSession {
func objectTask<T: Decodable>(
for request: URLRequest,
completion: @escaping (Result<T, Error>) -> Void
) -> URLSessionTask {
let decoder = SnakeCaseJSONDecoder()
let task = data(for: request) { (result: Result<Data, Error>) in
switch result {
case .success(let data):
do {
let object = try decoder.decode(T.self, from: data)
completion(.success(object))
} catch {
print("Error decoding: \(error.localizedDescription), Data: \(String(data: data, encoding: .utf8) ?? "")")
completion(.failure(error))
}
case .failure(let error):
print("[\(String(describing: self)).\(#function)]: - Error getting data: \(error.localizedDescription)")
completion(.failure(error))
}
}
return task
}
}
51 changes: 51 additions & 0 deletions FakeNFT/Models/Statistic/NFTCollectionModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// NFTCollectionModel.swift
// FakeNFT
//
// Created by Ilya Nikitash on 4/3/25.
//
import UIKit

struct NFTCollectionModel {
let createdAt: String
let name: String
let images: [String]
let rating: Int
let description: String
let price: Float
let author: String
let id: String

init(createdAt: String, name: String, images: [String], rating: Int, description: String, price: Float, author: String, id: String) {
self.createdAt = createdAt
self.name = name
self.images = images
self.rating = rating
self.description = description
self.price = price
self.author = author
self.id = id
}

init(result nft: NFTCollectionResult) {
self.createdAt = nft.createdAt
self.name = nft.name
self.images = nft.images
self.rating = nft.rating
self.description = nft.description
self.price = nft.price
self.author = nft.author
self.id = nft.id
}
}

struct NFTCollectionResult: Decodable {
let createdAt: String
let name: String
let images: [String]
let rating: Int
let description: String
let price: Float
let author: String
let id: String
}
47 changes: 47 additions & 0 deletions FakeNFT/Models/Statistic/UsersListModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// StatisticUsersListCellModel.swift
// FakeNFT
//
// Created by Ilya Nikitash on 3/15/25.
//
import UIKit

struct UsersListModel {
let name: String
let avatar: String
let description: String?
let website: String
let nfts: [String]
let rating: String
let id: String

init(name: String, avatar: String, description: String?, website: String, nfts: [String], rating: String, id: String) {
self.name = name
self.avatar = avatar
self.description = description
self.website = website
self.nfts = nfts
self.rating = rating
self.id = id
}

init(result user: UsersListResult) {
self.name = user.name
self.avatar = user.avatar
self.description = user.description
self.website = user.website
self.nfts = user.nfts
self.rating = user.rating
self.id = user.id
}
}

struct UsersListResult: Decodable {
let name: String
let avatar: String
let description: String?
let website: String
let nfts: [String]
let rating: String
let id: String
}
6 changes: 6 additions & 0 deletions FakeNFT/Resources/Assets.xcassets/Images/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Favourites [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Favourites icons.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"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.
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
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Stars.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"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.
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
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Cart.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "No [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "No Active.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"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.
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
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Stars.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"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.
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
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Light.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Light-1.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading