-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from Noostak/feat/NST-15/groupMember
[Feat/NST-13] group member 화면 구현완료
- Loading branch information
Showing
11 changed files
with
444 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Noostak_iOS/Noostak_iOS/Presentation/GroupMember/Reactor/GroupMemberCellReactor.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// GroupMemberCellReactor.swift | ||
// Noostak_iOS | ||
// | ||
// Created by 오연서 on 2/9/25. | ||
// | ||
|
||
import ReactorKit | ||
import RxSwift | ||
|
||
final class GroupMemberCellReactor: Reactor { | ||
typealias Action = NoAction | ||
struct State { | ||
let user: User | ||
} | ||
|
||
let initialState: State | ||
|
||
init(user: User) { | ||
self.initialState = State(user: user) | ||
} | ||
} | ||
|
||
let mockMemberData = Group(id: 1, | ||
name: "누트탁", | ||
code: "AKFJS", | ||
membersCount: 10, | ||
groupImage: "df", | ||
host: User(name: "오연서", userImage: "1"), | ||
members: [ | ||
User(name: "오연서", userImage: "1"), | ||
User(name: "오옹서", userImage: "1"), | ||
User(name: "오앵서", userImage: "1"), | ||
User(name: "오용서", userImage: "1"), | ||
User(name: "오잉서", userImage: "1"), | ||
User(name: "오옹서", userImage: "1"), | ||
User(name: "오앵서", userImage: "1"), | ||
User(name: "오용아", userImage: "1"), | ||
User(name: "오러서", userImage: "1"), | ||
User(name: "오엉서", userImage: "1")] | ||
) |
46 changes: 46 additions & 0 deletions
46
Noostak_iOS/Noostak_iOS/Presentation/GroupMember/Reactor/GroupMemberReactor.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// GroupMemberReactor.swift | ||
// Noostak_iOS | ||
// | ||
// Created by 오연서 on 2/9/25. | ||
// | ||
|
||
import ReactorKit | ||
import RxSwift | ||
import RxDataSources | ||
|
||
final class GroupMemberReactor: Reactor { | ||
enum Action { | ||
case loadGroupData | ||
} | ||
|
||
enum Mutation { | ||
case setGroup(Group) | ||
} | ||
|
||
struct State { | ||
var group: Group | ||
} | ||
|
||
let initialState: State | ||
|
||
init() { | ||
self.initialState = State(group: mockMemberData) | ||
} | ||
|
||
func mutate(action: Action) -> Observable<Mutation> { | ||
switch action { | ||
case .loadGroupData: | ||
return Observable.just(.setGroup(currentState.group)) | ||
} | ||
} | ||
|
||
func reduce(state: State, mutation: Mutation) -> State { | ||
var newState = state | ||
switch mutation { | ||
case .setGroup(let group): | ||
newState.group = group | ||
} | ||
return newState | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
Noostak_iOS/Noostak_iOS/Presentation/GroupMember/View/Cell/GroupMemberCVC.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// GroupMemberCVC.swift | ||
// Noostak_iOS | ||
// | ||
// Created by 오연서 on 2/9/25. | ||
// | ||
|
||
import UIKit | ||
import SnapKit | ||
import Then | ||
import ReactorKit | ||
|
||
final class GroupMemberCVC: UICollectionViewCell, View { | ||
|
||
// MARK: Properties | ||
static let identifier = "GroupMemberCVC" | ||
var disposeBag = DisposeBag() | ||
|
||
// MARK: Views | ||
private let memberProfile = UIImageView() | ||
private let memberName = UILabel() | ||
|
||
// MARK: Init | ||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setUpHierarchy() | ||
setUpUI() | ||
setUpLayout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
// MARK: setUpHierarchy | ||
private func setUpHierarchy() { | ||
[memberProfile, memberName].forEach { | ||
self.addSubview($0) | ||
} | ||
} | ||
|
||
// MARK: setUpUI | ||
private func setUpUI() { | ||
memberProfile.do { | ||
$0.image = .imgProfileFilled | ||
$0.layer.cornerRadius = 30.5 | ||
} | ||
|
||
memberName.do { | ||
$0.font = .PretendardStyle.c3_sb.font | ||
$0.textColor = .appGray900 | ||
} | ||
} | ||
|
||
// MARK: setUpLayout | ||
private func setUpLayout() { | ||
memberProfile.snp.makeConstraints { | ||
$0.top.centerX.equalToSuperview() | ||
$0.size.equalTo(61) | ||
} | ||
|
||
memberName.snp.makeConstraints { | ||
$0.top.equalTo(memberProfile.snp.bottom).offset(4) | ||
$0.centerX.equalTo(memberProfile) | ||
} | ||
} | ||
} | ||
|
||
extension GroupMemberCVC { | ||
func bind(reactor: GroupMemberCellReactor) { | ||
let user = reactor.currentState.user | ||
memberProfile.image = .imgProfileFilled //api 연결시 변경 | ||
memberName.text = user.name | ||
} | ||
} |
Oops, something went wrong.