Skip to content

Commit

Permalink
🔀 Merge: feature/#4-home -> main
Browse files Browse the repository at this point in the history
[ FEATURE ] 홈 화면 레이아웃 및 기능 구현
  • Loading branch information
kayeon2 authored Dec 5, 2024
2 parents 59a5873 + daaa5a8 commit 5d0e306
Show file tree
Hide file tree
Showing 41 changed files with 1,650 additions and 10 deletions.
50 changes: 42 additions & 8 deletions UMC-7th-TEAM-IOS-FE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
/* Begin PBXBuildFile section */
231FCC102CFA348B000483A0 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 231FCC0F2CFA348B000483A0 /* SnapKit */; };
231FCC132CFA3495000483A0 /* Then in Frameworks */ = {isa = PBXBuildFile; productRef = 231FCC122CFA3495000483A0 /* Then */; };
233068F92CFF227400BD5C77 /* ToosieSlide in Frameworks */ = {isa = PBXBuildFile; productRef = 233068F82CFF227400BD5C77 /* ToosieSlide */; };
2C32CCF02D01C4920031DB98 /* ToosieSlide in Frameworks */ = {isa = PBXBuildFile; productRef = 2C32CCEF2D01C4920031DB98 /* ToosieSlide */; };
2CDE82B72CFDC5560074DD80 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 2CDE82B62CFDC5560074DD80 /* Alamofire */; };
2CDE82C02CFDC9E90074DD80 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 2CDE82BF2CFDC9E90074DD80 /* Kingfisher */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -42,9 +44,11 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2CDE82C02CFDC9E90074DD80 /* Kingfisher in Frameworks */,
2CDE82B72CFDC5560074DD80 /* Alamofire in Frameworks */,
2C32CCF02D01C4920031DB98 /* ToosieSlide in Frameworks */,
231FCC102CFA348B000483A0 /* SnapKit in Frameworks */,
231FCC132CFA3495000483A0 /* Then in Frameworks */,
233068F92CFF227400BD5C77 /* ToosieSlide in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -89,7 +93,9 @@
packageProductDependencies = (
231FCC0F2CFA348B000483A0 /* SnapKit */,
231FCC122CFA3495000483A0 /* Then */,
233068F82CFF227400BD5C77 /* ToosieSlide */,
2CDE82B62CFDC5560074DD80 /* Alamofire */,
2CDE82BF2CFDC9E90074DD80 /* Kingfisher */,
2C32CCEF2D01C4920031DB98 /* ToosieSlide */,
);
productName = "UMC-7th-TEAM-IOS-FE";
productReference = 18CB3B592CF8120600F9B499 /* UMC-7th-TEAM-IOS-FE.app */;
Expand Down Expand Up @@ -122,7 +128,9 @@
packageReferences = (
231FCC0E2CFA348B000483A0 /* XCRemoteSwiftPackageReference "SnapKit" */,
231FCC112CFA3495000483A0 /* XCRemoteSwiftPackageReference "Then" */,
233068F72CFF227400BD5C77 /* XCRemoteSwiftPackageReference "ToosieSlide" */,
2CDE82B52CFDC5560074DD80 /* XCRemoteSwiftPackageReference "Alamofire" */,
2CDE82BE2CFDC9E90074DD80 /* XCRemoteSwiftPackageReference "Kingfisher" */,
2C32CCEE2D01C4920031DB98 /* XCRemoteSwiftPackageReference "ToosieSlide" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = 18CB3B5A2CF8120600F9B499 /* Products */;
Expand Down Expand Up @@ -366,14 +374,30 @@
minimumVersion = 3.0.0;
};
};
233068F72CFF227400BD5C77 /* XCRemoteSwiftPackageReference "ToosieSlide" */ = {
2C32CCEE2D01C4920031DB98 /* XCRemoteSwiftPackageReference "ToosieSlide" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/TheInkedEngineer/ToosieSlide.git";
repositoryURL = "https://github.com/TheInkedEngineer/ToosieSlide";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.1.1;
};
};
2CDE82B52CFDC5560074DD80 /* XCRemoteSwiftPackageReference "Alamofire" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Alamofire/Alamofire";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 5.10.2;
};
};
2CDE82BE2CFDC9E90074DD80 /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/onevcat/Kingfisher";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 8.1.1;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -387,11 +411,21 @@
package = 231FCC112CFA3495000483A0 /* XCRemoteSwiftPackageReference "Then" */;
productName = Then;
};
233068F82CFF227400BD5C77 /* ToosieSlide */ = {
2C32CCEF2D01C4920031DB98 /* ToosieSlide */ = {
isa = XCSwiftPackageProductDependency;
package = 233068F72CFF227400BD5C77 /* XCRemoteSwiftPackageReference "ToosieSlide" */;
package = 2C32CCEE2D01C4920031DB98 /* XCRemoteSwiftPackageReference "ToosieSlide" */;
productName = ToosieSlide;
};
2CDE82B62CFDC5560074DD80 /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 2CDE82B52CFDC5560074DD80 /* XCRemoteSwiftPackageReference "Alamofire" */;
productName = Alamofire;
};
2CDE82BF2CFDC9E90074DD80 /* Kingfisher */ = {
isa = XCSwiftPackageProductDependency;
package = 2CDE82BE2CFDC9E90074DD80 /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 18CB3B512CF8120600F9B499 /* Project object */;
Expand Down
1 change: 0 additions & 1 deletion UMC-7th-TEAM-IOS-FE/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "dbcdc6be1ee94fcb8996bcbab2f3bb8a.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "f776735287f493e66ca5ffbed348e5ae.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Group 27.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Vector-4.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Group 9.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Group 29.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Group 10.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Vector-2.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Frame 18.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "e8368380-f79c-47c5-8679-fde01743aaf5.jpeg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
50 changes: 50 additions & 0 deletions UMC-7th-TEAM-IOS-FE/Home/Models/HomeCellModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// HomeCellModel.swift
// UMC-7th-TEAM-IOS-FE
//
// Created by 선가연 on 12/2/24.
//

import Foundation

struct BannerModel: RequiredCellProtocol {
var imageView: String
}

struct BookResponse: Codable {
let isSuccess: Bool
let code: String
let message: String
let result: BookResult
}

struct BookResult: Codable {
let isLast: Bool
let totalPage: Int
let totalElement: Int
let books: [BookModel]
}

struct BookModel: Codable {
let id: Int
let imgUrl: String
let title: String
let author: String
let publisher: String
let rating: Double?
let reviewCount: Int
let description: String
}

final class HomeCellModel {
static let bannerData: [BannerModel] = [
BannerModel(imageView: "home_banner")
]

// 인기 도서 더미 데이터
static let bestSellerData: [BookModel] = [
BookModel(id: 1, imgUrl: "https://shopping-phinf.pstatic.net/main_3244161/32441616160.20220518182757.jpg?type=w300", title: "작별하지 않는다", author: "한강", publisher: "문학동네", rating: 4.9, reviewCount: 2, description: "작가의 성숙한 의식과 단정하고 묵직하면서도 정갈한 문체로 쓰인 작품이다. 현실의 대비와 비교에 의한 의식이 돋"),
BookModel(id: 2, imgUrl: "https://shopping-phinf.pstatic.net/main_3244161/32441616160.20220518182757.jpg?type=w300", title: "작별하지 않는다", author: "한강", publisher: "문학동네", rating: 4.3, reviewCount: 5, description: "작가의 성숙한 의식과 단정하고 묵직하면서도 정갈한 문체로 쓰인 작품이다. 현실의 대비와 비교에 의한 의식이 돋"),
BookModel(id: 3, imgUrl: "https://shopping-phinf.pstatic.net/main_3244161/32441616160.20220518182757.jpg?type=w300", title: "작별하지 않는다", author: "한강", publisher: "문학동네", rating: 4.1, reviewCount: 3, description: "작가의 성숙한 의식과 단정하고 묵직하면서도 정갈한 문체로 쓰인 작품이다. 현실의 대비와 비교에 의한 의식이 돋"),
]
}
36 changes: 36 additions & 0 deletions UMC-7th-TEAM-IOS-FE/Home/Service/HomeService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// HomeService.swift
// UMC-7th-TEAM-IOS-FE
//
// Created by 선가연 on 12/2/24.
//

import Foundation
import Alamofire

final class HomeService {

static let shared = HomeService()
private init() {}

// 추천 도서
func fetchBooks(sortedBy: String, page: Int, size: Int, completion: @escaping (Result<[BookModel], Error>) -> Void) {
let baseURL = "http://ec2-3-39-137-120.ap-northeast-2.compute.amazonaws.com:8080/books"
let parameters: [String: Any] = [
"sortedBy": sortedBy,
"page": page,
"size": size
]

AF.request(baseURL, method: .get, parameters: parameters)
.validate()
.responseDecodable(of: BookResponse.self) { response in
switch response.result {
case .success(let data):
completion(.success(data.result.books))
case .failure(let error):
completion(.failure(error))
}
}
}
}
Loading

0 comments on commit 5d0e306

Please sign in to comment.