Skip to content

Commit

Permalink
[Add] Podfile Reinstall (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcsoyeon committed May 28, 2022
1 parent 79aa0e2 commit ea6c003
Show file tree
Hide file tree
Showing 103 changed files with 18,733 additions and 2,248 deletions.
46 changes: 41 additions & 5 deletions Instagram/Instagram.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
9201FE52282E322A00443946 /* SignInService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9201FE51282E322A00443946 /* SignInService.swift */; };
9201FE54282E327C00443946 /* AuthRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9201FE53282E327C00443946 /* AuthRequest.swift */; };
9201FE56282E33E800443946 /* SignInAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9201FE55282E33E800443946 /* SignInAPI.swift */; };
9201FE5B282E3AF100443946 /* HomeResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9201FE5A282E3AF100443946 /* HomeResponse.swift */; };
9201FE5D282E3B6400443946 /* HomeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9201FE5C282E3B6400443946 /* HomeService.swift */; };
9201FE5F282E3C1F00443946 /* HomeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9201FE5E282E3C1F00443946 /* HomeAPI.swift */; };
920995A8280DD79F008C3491 /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920995A7280DD79F008C3491 /* TabBarController.swift */; };
920995AB280DD965008C3491 /* SearchMainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920995AA280DD965008C3491 /* SearchMainViewController.swift */; };
920995AF280DD9AD008C3491 /* ShopMainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920995AE280DD9AD008C3491 /* ShopMainViewController.swift */; };
Expand Down Expand Up @@ -70,6 +73,9 @@
9201FE51282E322A00443946 /* SignInService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInService.swift; sourceTree = "<group>"; };
9201FE53282E327C00443946 /* AuthRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthRequest.swift; sourceTree = "<group>"; };
9201FE55282E33E800443946 /* SignInAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInAPI.swift; sourceTree = "<group>"; };
9201FE5A282E3AF100443946 /* HomeResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeResponse.swift; sourceTree = "<group>"; };
9201FE5C282E3B6400443946 /* HomeService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeService.swift; sourceTree = "<group>"; };
9201FE5E282E3C1F00443946 /* HomeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeAPI.swift; sourceTree = "<group>"; };
920995A7280DD79F008C3491 /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; };
920995AA280DD965008C3491 /* SearchMainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchMainViewController.swift; sourceTree = "<group>"; };
920995AE280DD9AD008C3491 /* ShopMainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopMainViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -147,6 +153,30 @@
path = Pods;
sourceTree = "<group>";
};
9201FE57282E3AAA00443946 /* Home */ = {
isa = PBXGroup;
children = (
9201FE5C282E3B6400443946 /* HomeService.swift */,
);
path = Home;
sourceTree = "<group>";
};
9201FE58282E3AB500443946 /* Home */ = {
isa = PBXGroup;
children = (
9201FE5E282E3C1F00443946 /* HomeAPI.swift */,
);
path = Home;
sourceTree = "<group>";
};
9201FE59282E3ABD00443946 /* Home */ = {
isa = PBXGroup;
children = (
9201FE5A282E3AF100443946 /* HomeResponse.swift */,
);
path = Home;
sourceTree = "<group>";
};
920995A9280DD950008C3491 /* Search */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -241,7 +271,7 @@
isa = PBXGroup;
children = (
921E576327FAD9F500CDC913 /* API */,
921E576427FAD9FF00CDC913 /* DataModel */,
921E576427FAD9FF00CDC913 /* APIModel */,
921E576527FADA0700CDC913 /* Service */,
921E576627FADA3A00CDC913 /* Utility */,
);
Expand Down Expand Up @@ -320,22 +350,25 @@
921E576327FAD9F500CDC913 /* API */ = {
isa = PBXGroup;
children = (
9201FE58282E3AB500443946 /* Home */,
92BF252A2829676A00DE0205 /* Auth */,
);
path = API;
sourceTree = "<group>";
};
921E576427FAD9FF00CDC913 /* DataModel */ = {
921E576427FAD9FF00CDC913 /* APIModel */ = {
isa = PBXGroup;
children = (
9201FE59282E3ABD00443946 /* Home */,
92BF252F2829685000DE0205 /* Auth */,
);
path = DataModel;
path = APIModel;
sourceTree = "<group>";
};
921E576527FADA0700CDC913 /* Service */ = {
isa = PBXGroup;
children = (
9201FE57282E3AAA00443946 /* Home */,
92BF25292829675400DE0205 /* Auth */,
);
path = Service;
Expand Down Expand Up @@ -511,7 +544,7 @@
921E573327FACB1A00CDC913 /* Sources */,
921E573427FACB1A00CDC913 /* Frameworks */,
921E573527FACB1A00CDC913 /* Resources */,
2BC0F4C06902F95C74337A91 /* [CP] Embed Pods Frameworks */,
8512CE3ABBFA202A1235F577 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -593,7 +626,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
2BC0F4C06902F95C74337A91 /* [CP] Embed Pods Frameworks */ = {
8512CE3ABBFA202A1235F577 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -645,6 +678,7 @@
9201FE52282E322A00443946 /* SignInService.swift in Sources */,
921E579027FADF7B00CDC913 /* SignUpView.swift in Sources */,
92BF252E2829678F00DE0205 /* SignUpService.swift in Sources */,
9201FE5B282E3AF100443946 /* HomeResponse.swift in Sources */,
9201FE56282E33E800443946 /* SignInAPI.swift in Sources */,
921E576E27FADA7800CDC913 /* BaseResponse.swift in Sources */,
92920C7527FAE95F00DCABC7 /* Assets+Generated.swift in Sources */,
Expand All @@ -660,13 +694,15 @@
921E578127FADC5B00CDC913 /* AuthCompleteView.swift in Sources */,
921E573B27FACB1A00CDC913 /* AppDelegate.swift in Sources */,
921E577B27FADC2E00CDC913 /* SignInViewController.swift in Sources */,
9201FE5D282E3B6400443946 /* HomeService.swift in Sources */,
920995AB280DD965008C3491 /* SearchMainViewController.swift in Sources */,
921E578E27FADD8E00CDC913 /* AuthCompleteViewController.swift in Sources */,
92BF253528296A8800DE0205 /* SignUpRequest.swift in Sources */,
924AC4CD2816A7DB0056F0A5 /* HomeMainStoryTableViewCell.swift in Sources */,
92920C7727FAF71C00DCABC7 /* Reactive+.swift in Sources */,
921E578827FADCFA00CDC913 /* HomeMainModel.swift in Sources */,
924AC4D72816C18D0056F0A5 /* UILabel+.swift in Sources */,
9201FE5F282E3C1F00443946 /* HomeAPI.swift in Sources */,
920995A8280DD79F008C3491 /* TabBarController.swift in Sources */,
921E573D27FACB1A00CDC913 /* SceneDelegate.swift in Sources */,
921E575C27FAD1DF00CDC913 /* IDSFont.swift in Sources */,
Expand Down
42 changes: 42 additions & 0 deletions Instagram/Instagram/Network/API/Home/HomeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,45 @@
//

import Foundation

import Moya

final class HomeAPI {

// MARK: - Static Properties

static let shared: HomeAPI = HomeAPI()
private init() { }

// MARK: - Network Properties

private let homeProvider = MoyaProvider<HomeService>(plugins: [MoyaLoggerPlugin()])

public private(set) var homeResponse: BaseArrayResponseType<HomeResponse>?
public private(set) var homeData: [HomeResponse]?

func getImageList(completion: @escaping (([HomeResponse]?, Error?) -> ())) {
homeProvider.request(.imageList) { [weak self] response in
guard let self = self else { return }
switch response {
case .success(let result):
do {
self.homeResponse = try result.map(BaseArrayResponseType<HomeResponse>.self)
guard let data = self.homeResponse?.data else {
completion(nil, Error.self as? Error)
return
}
self.homeData = data

completion(data, nil)
} catch(let err) {
print(err.localizedDescription)
completion(nil, err)
}
case .failure(let err):
print(err.localizedDescription)
completion(nil, err)
}
}
}
}
13 changes: 13 additions & 0 deletions Instagram/Instagram/Network/APIModel/Home/HomeResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,16 @@
//

import Foundation

// MARK: - HomeResponse

struct HomeResponse: Codable {
let id, author: String
let width, height: Int
let url, downloadURL: String

enum CodingKeys: String, CodingKey {
case id, author, width, height, url
case downloadURL = "download_url"
}
}
52 changes: 52 additions & 0 deletions Instagram/Instagram/Network/Service/Home/HomeService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,55 @@
//

import Foundation

import Moya

enum HomeService {
case imageList
}

extension HomeService: TargetType {

var baseURL: URL {
return URL(string: GeneralAPI.imageBaseURL)!
}

var path: String {
switch self {
case .imageList:
return GeneralAPI.imageList
}
}

var parameterEncoding: ParameterEncoding {
switch self {
case .imageList:
return JSONEncoding.default
}
}

var method: Moya.Method {
switch self {
case .imageList:
return .get
}
}

var sampleData: Data {
return Data()
}

var task: Task {
switch self {
case .imageList:
return .requestPlain
}
}

var headers: [String: String]? {
switch self {
case .imageList:
return ["Content-Type": "application/json"]
}
}
}
2 changes: 1 addition & 1 deletion Instagram/Instagram/Network/Utility/BaseResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct BaseResponse<T: Decodable>: Decodable {
}

struct BaseArrayResponseType<T: Decodable>: Decodable {
let status: Int
let status: Int?
let success: Bool?
let message: String?
let data: [T]?
Expand Down
4 changes: 4 additions & 0 deletions Instagram/Instagram/Network/Utility/GeneralAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ struct GeneralAPI {

static let baseURL = "http://13.124.62.236"

static let imageBaseURL = "https://picsum.photos/v2"

// MARK: - Feature URL

static let signInURL = "/auth/signin"
static let signUpURL = "/auth/signup"

static let imageList = "/list"
}
2 changes: 1 addition & 1 deletion Instagram/Instagram/Resource/Support/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let scene = (scene as? UIWindowScene) else { return }
self.window = UIWindow(windowScene: scene)
self.window?.rootViewController = SignInViewController()
self.window?.rootViewController = TabBarController()
self.window?.makeKeyAndVisible()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import Then

final class HomeMainViewController: UIViewController {

// MARK: - Network

private let homeAPI = HomeAPI.shared

// MARK: - Properties

var disposeBag = DisposeBag()

private lazy var rootView = HomeMainView()
Expand Down Expand Up @@ -52,6 +58,11 @@ final class HomeMainViewController: UIViewController {

private func bind() {
rootView.delegate = self

self.homeAPI.getImageList() { data, err in
guard let data = data else { return }
dump(data)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import UIKit
import SnapKit
import Then

import Kingfisher

protocol HomeMainContentTableViewCellDelegate: AnyObject {
func touchUpLikeButton(index: Int)
}
Expand Down Expand Up @@ -182,7 +184,7 @@ final class HomeMainContentTableViewCell: UITableViewCell {
// MARK: - Custom Method

internal func setData(_ data: HomeMainContentDataModel) {
userImageView.image = data.userImage

userNameLabel.text = data.userName
contentUserNameLabel.text = data.userName
contentImageView.image = data.contentImage
Expand All @@ -191,6 +193,11 @@ final class HomeMainContentTableViewCell: UITableViewCell {
commentLabel.text = "댓글 \(data.commentCount) 모두 보기"
}

internal func setImage(_ data: String) {
let url = URL(string: data)
userImageView.kf.setImage(with: url)
}

// MARK: - @objc

@objc func touchUpLikeButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ final class HomeMainView: UIView {

weak var delegate: HomeMainViewDelegate?

var imageList = [HomeResponse]()

// MARK: - Initializer

init() {
Expand Down Expand Up @@ -170,6 +172,8 @@ extension HomeMainView: UITableViewDataSource {
cell.index = indexPath.row
cell.setData(HomeMainContentDataModel.sampleData[indexPath.row])
cell.delegate = self
// FIXME: - ERROR: Out Of Index
// cell.setImage(imageList[indexPath.row].downloadURL)
return cell
default:
return UITableViewCell()
Expand Down
2 changes: 2 additions & 0 deletions Instagram/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ target 'Instagram' do
pod 'Then', '2.7.0'
pod 'SnapKit', '5.0.1'

pod 'Kingfisher', '~> 7.0'

pod 'SwiftGen', '~> 6.0'

pod 'RxSwift', '6.2.0'
Expand Down
Loading

0 comments on commit ea6c003

Please sign in to comment.