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
Binary file modified .DS_Store
Binary file not shown.
Binary file modified Marketplace/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions Marketplace/.swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--indent 4 # Отступы в 4 пробела
--linebreaks crlf # Использует Unix-стиль перевода строк (LF вместо CRLF)
--wraparguments before-first # Переносит аргументы на новую строку
--stripunusedargs closure-only # Удаляет неиспользуемые аргументы только у замыканий
--commas inline # Оставляет запятые в той же строке
--ranges spaced # Оставляет пробелы вокруг операторов диапазона (1 ... 10)
27 changes: 12 additions & 15 deletions Marketplace/CoreData/ProductData+CoreDataClass.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
//
// ProductData+CoreDataClass.swift
// Marketplace
//
// Created by Алексей Кобяков on 22.10.2022.
//
//

import Foundation
import CoreData


public class ProductData: NSManagedObject {

}
//
// ProductData+CoreDataClass.swift
// Marketplace
//
// Created by Алексей Кобяков on 22.10.2022.
//
//

import CoreData
import Foundation

public class ProductData: NSManagedObject {}
51 changes: 23 additions & 28 deletions Marketplace/CoreData/ProductData+CoreDataProperties.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
//
// ProductData+CoreDataProperties.swift
// Marketplace
//
// Created by Алексей Кобяков on 22.10.2022.
//
//

import Foundation
import CoreData


extension ProductData {

@nonobjc public class func fetchRequest() -> NSFetchRequest<ProductData> {
return NSFetchRequest<ProductData>(entityName: "ProductData")
}

@NSManaged public var productImage: Data?
@NSManaged public var productTitle: String?
@NSManaged public var productPrice: String?
@NSManaged public var productDescription: String?

}

extension ProductData : Identifiable {

}
//
// ProductData+CoreDataProperties.swift
// Marketplace
//
// Created by Алексей Кобяков on 22.10.2022.
//
//

import CoreData
import Foundation

public extension ProductData {
@nonobjc class func fetchRequest() -> NSFetchRequest<ProductData> {
return NSFetchRequest<ProductData>(entityName: "ProductData")
}

@NSManaged var productImage: Data?
@NSManaged var productTitle: String?
@NSManaged var productPrice: String?
@NSManaged var productDescription: String?
}

extension ProductData: Identifiable {}
33 changes: 15 additions & 18 deletions Marketplace/File.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
//
// File.swift
// Marketplace
//
// Created by Алексей Кобяков on 17.06.2024.
//

import Foundation

final class MyClass: Sendable {

@Sendable func loadPages() async {
await withTaskGroup(of: Void.self) { group in

}
}

}
//
// File.swift
// Marketplace
//
// Created by Алексей Кобяков on 17.06.2024.
//

import Foundation

final class MyClass: Sendable {
@Sendable func loadPages() async {
await withTaskGroup(of: Void.self) { _ in
}
}
}
21 changes: 21 additions & 0 deletions Marketplace/Marketplace.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
5B02EC5028E4234300124D5B /* Sources */,
5B02EC5128E4234300124D5B /* Frameworks */,
5B02EC5228E4234300124D5B /* Resources */,
5BA6121C2D942DFD00FF5BD2 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -198,6 +199,26 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
5BA6121C2D942DFD00FF5BD2 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nif which swiftformat > /dev/null; then\n swiftformat .\n echo \"Start scanning...\"\nelse \n echo \"WARNING: SwiftLing not installed!\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
5B02EC5028E4234300124D5B /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
Binary file not shown.
Binary file modified Marketplace/Marketplace/.DS_Store
Binary file not shown.
66 changes: 30 additions & 36 deletions Marketplace/Marketplace/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
//
// AppDelegate.swift
// Marketplace
//
// Created by Алексей Кобяков on 28.09.2022.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

//
// AppDelegate.swift
// Marketplace
//
// Created by Алексей Кобяков on 28.09.2022.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_: UIApplication, didDiscardSceneSessions _: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
148 changes: 74 additions & 74 deletions Marketplace/Marketplace/Cart/CartProductCell.swift
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
//
// CartProductCell.swift
// Marketplace
//
// Created by Алексей Кобяков on 06.10.2022.
//

import UIKit

class CartProductCell: UITableViewCell {

private lazy var image: UIImageView = {
let image = UIImageView(image: UIImage(systemName: "tshirt"))
image.translatesAutoresizingMaskIntoConstraints = false
image.contentMode = .scaleAspectFit
return image
}()

private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 20, weight: .medium)
label.textColor = .black
label.textAlignment = .center
label.numberOfLines = 3
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

private lazy var priceLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 16, weight: .bold)
label.textColor = .black
label.textAlignment = .right
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

contentView.addSubview(image)
contentView.addSubview(titleLabel)
contentView.addSubview(priceLabel)

setupConstraints()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupConstraints() {
image.widthAnchor.constraint(equalToConstant: contentView.frame.width/4).isActive = true
image.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 5).isActive = true
image.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0).isActive = true
image.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 0).isActive = true
priceLabel.widthAnchor.constraint(equalToConstant: contentView.frame.width/4).isActive = true
priceLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0).isActive = true
priceLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 0).isActive = true
priceLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -5).isActive = true
titleLabel.leadingAnchor.constraint(equalTo: image.trailingAnchor, constant: 10).isActive = true
titleLabel.trailingAnchor.constraint(equalTo: priceLabel.leadingAnchor, constant: -10).isActive = true
titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0).isActive = true
titleLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 0).isActive = true
}
func configure(_ viewModel: ProductData) {
titleLabel.text = viewModel.productTitle
priceLabel.text = (viewModel.productPrice ?? "") + "$"
image.image = UIImage(data: viewModel.productImage ?? Data())
}
}
//
// CartProductCell.swift
// Marketplace
//
// Created by Алексей Кобяков on 06.10.2022.
//
import UIKit
class CartProductCell: UITableViewCell {
private lazy var image: UIImageView = {
let image = UIImageView(image: UIImage(systemName: "tshirt"))
image.translatesAutoresizingMaskIntoConstraints = false
image.contentMode = .scaleAspectFit
return image
}()
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 20, weight: .medium)
label.textColor = .black
label.textAlignment = .center
label.numberOfLines = 3
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
private lazy var priceLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 16, weight: .bold)
label.textColor = .black
label.textAlignment = .right
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
contentView.addSubview(image)
contentView.addSubview(titleLabel)
contentView.addSubview(priceLabel)
setupConstraints()
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupConstraints() {
image.widthAnchor.constraint(equalToConstant: contentView.frame.width / 4).isActive = true
image.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 5).isActive = true
image.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0).isActive = true
image.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 0).isActive = true
priceLabel.widthAnchor.constraint(equalToConstant: contentView.frame.width / 4).isActive = true
priceLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0).isActive = true
priceLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 0).isActive = true
priceLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -5).isActive = true
titleLabel.leadingAnchor.constraint(equalTo: image.trailingAnchor, constant: 10).isActive = true
titleLabel.trailingAnchor.constraint(equalTo: priceLabel.leadingAnchor, constant: -10).isActive = true
titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0).isActive = true
titleLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 0).isActive = true
}
func configure(_ viewModel: ProductData) {
titleLabel.text = viewModel.productTitle
priceLabel.text = (viewModel.productPrice ?? "") + "$"
image.image = UIImage(data: viewModel.productImage ?? Data())
}
}
Loading