Skip to content

๐ŸŽํ•˜์šฐ์•„์š”? ์•”ํŒŒ์ธ๋•กํ์•ค์ฅฌ?๐ŸŽ

Notifications You must be signed in to change notification settings

teamHousing/Housing_iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Housing iOS ๐Ÿ 

์Šคํฌ๋ฆฐ์ƒท 2021-01-03 ์˜คํ›„ 11 04 58

๐ŸŽ SOPT 27th APPJAM ๐ŸŽ

HOUSING iOS
- 2020.12.26 ~ 2021.01.16

๋ชฉ์ฐจ

๊ฐœ๋ฐœํ™˜๊ฒฝ ๋ฐ ์‚ฌ์šฉํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ชฉ์ 
RxSwift ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ SPM
Kingfisher ์ด๋ฏธ์ง€ ์บ์‹ค SPM
SnapKit ์˜คํ†  ๋ ˆ์ด์•„์›ƒ SPM
Alamofire ์„œ๋ฒ„ ํ†ต์‹  SPM
Then ์ปดํฌ๋„ŒํŠธ ์ฝ”๋“œ ์ž‘์„ฑ์˜ ์šฉ์ด๋ฅผ ์œ„ํ•ด SPM
FSCalendar ์บ˜๋ฆฐ๋” ์‚ฌ์šฉ SPM
SwiftKeychainWrapper ์ €์žฅ์†Œ ์•”ํ˜ธํ™” SPM
YPImagePicker ์‚ฌ์ง„์ฒฉ ์‚ฌ์šฉ SPM
RxKeyboard ํ‚ค๋ณด๋“œ ๋™์  ์‚ฌ์šฉ SPM
Moya ์„œ๋ฒ„ ํ†ต์‹  SPM
Lottie ์• ๋‹ˆ๋ฉ”์ด์…˜ ์‚ฌ์šฉ SPM
SegementSlide ํƒญ๋ฐ” ์‚ฌ์šฉ CocoaPod

์„œ๋น„์Šค workflow

KakaoTalk_Photo_2021-01-15-22-54-18

๊ธฐ๋Šฅ ๊ฐœ๋ฐœ์—ฌ๋ถ€/๋‹ด๋‹น์ž

  1. ์„ธ์ž…์ž
๊ธฐ๋Šฅ ์ƒ์„ธ ๊ธฐ๋Šฅ ๋‹ด๋‹น์ž ๊ตฌํ˜„ ์—ฌ๋ถ€ ํ†ต์‹  ๊ตฌํ˜„ ์—ฌ๋ถ€
์Šคํ”Œ๋ž˜์‹œ ์Šคํ”Œ๋ž˜์‹œ ์ค€ํ˜„ โœ… โœ…
๋กœ๊ทธ์ธ ๋กœ๊ทธ์ธ ๋ฏผ์ œ โœ… โœ…
ํšŒ์›๊ฐ€์ž… ์ดˆ๋Œ€ ์ธ์ฆ ๋ฏผ์ œ โœ… โœ…
ํšŒ์›๊ฐ€์ž… ๋ฏผ์ œ โœ… โœ…
์†Œํ†ตํ•˜๊ธฐ ์†Œํ†ตํ•˜๊ธฐ ์ฃผ์€ โœ… โœ…
์†Œํ†ตํ•˜๊ธฐ ์ƒ์„ธ ํ•œ์†” โœ… โœ…
๋ฌธ์˜ ์ž‘์„ฑ ํƒœํ›ˆ โœ… โœ…
์บ˜๋ฆฐ๋” ์บ˜๋ฆฐ๋” ์ค€ํ˜„ โœ… โœ…
๋‹น์ผ ๋ฌธ์˜/๊ณต์ง€์‚ฌํ•ญ ๋ณด๊ธฐ ์ค€ํ˜„ โœ… โœ…
์šฐ๋ฆฌ์ง‘ ์†Œ์‹ ์ž„๋Œ€์ธ ํ”„๋กœํ•„ ๋ฏผ์ œ โœ… โœ…
๊ณต์ง€์‚ฌํ•ญ ๋ฏผ์ œ โœ… โœ…
  1. ์ง‘์ฃผ์ธ
๊ธฐ๋Šฅ ์ƒ์„ธ๊ธฐ๋Šฅ ๋‹ด๋‹น์ž ๊ตฌํ˜„ ์—ฌ๋ถ€ ํ†ต์‹  ๊ตฌํ˜„ ์—ฌ๋ถ€
์Šคํ”Œ๋ž˜์‹œ ์Šคํ”Œ๋ž˜์‹œ ์ค€ํ˜„ โœ… โœ…
๋กœ๊ทธ์ธ ๋กœ๊ทธ์ธ ๋ฏผ์ œ โœ… โœ…
ํšŒ์›๊ฐ€์ž… ํšŒ์›๊ฐ€์ž… ๋ฏผ์ œ โœ… โœ…
์†Œํ†ตํ•˜๊ธฐ ์†Œํ†ตํ•˜๊ธฐ ์ฃผ์€ โœ… โœ…
์†Œํ†ตํ•˜๊ธฐ ์ƒ์„ธ ํ•œ์†” โœ… โœ…
๋ฌธ์˜ ํ™•์ธ ํ•œ์†” โœ… โœ…
์บ˜๋ฆฐ๋” ์บ˜๋ฆฐ๋” ์ค€ํ˜„ โœ… โœ…
๋‹น์ผ ๋ฌธ์˜/๊ณต์ง€์‚ฌํ•ญ ๋ณด๊ธฐ ์ค€ํ˜„ โœ… โœ…
์šฐ๋ฆฌ์ง‘ ์†Œ์‹ ๋‚ด ํ”„๋กœํ•„ ๋ฏผ์ œ โœ… โœ…
๊ณต์ง€์‚ฌํ•ญ ๋ฏผ์ œ โœ… โœ…
๊ณต์ง€์‚ฌํ•ญ ์ž‘์„ฑ ํƒœํ›ˆ โœ… โœ…
์ดˆ๋Œ€ ๋ฒˆํ˜ธ ์ƒ์„ฑ ํƒœํ›ˆ โœ… โœ…

ํ•ต์‹ฌ๊ธฐ๋Šฅ ๊ตฌํ˜„ ๋ฐฉ๋ฒ•

  1. ์บ˜๋ฆฐ๋”

    FSCalendar ๋ฅผ ์ด์šฉํ•ด ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

    ๊ตฌํ˜„ ์ค‘ ๊ฐ€์žฅ ์ค‘์š”ํ•˜๋‹ค ์ƒ๊ฐํ•˜๋Š” ๋ถ€๋ถ„์€ ์บ˜๋ฆฐ๋” ๋‚ด ์ •๋ณด ๊ด€๋ฆฌ๋ถ€๋ถ„์ธ๋ฐ์š”.

    ์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋‚ ์งœ ์ •๋ณด๋ฅผ ๋ฐ›์•„์™€ Dictionaryํ˜•ํƒœ๋กœ ๋งŒ๋“ค์–ด ์ €์žฅ์„ ํ•ด๋‘๊ณ ([String : [CalendarModel]])

    ์‚ฌ์šฉ์ž์—๊ฒŒ ํ•ด๋‹นํ•˜๋Š” ๋‚ ์งœ์— ์ •๋ณด๊ฐ€ ์žˆ๋Š”๊ฒฝ์šฐ ๋ฐ˜๋ณต๋ฌธ์„ ๋Œ๋ฆฌ๋Š”๊ฒƒ๋ณด๋‹ค ํšจ์œจ์ ์œผ๋กœ ์ •๋ณด ํ˜ธ์ถœ์„ ํ• ์ˆ˜๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

    // ์บ˜๋ฆฐ๋” ์ •๋ณด ์ €์žฅ์„ ์œ„ํ•œ ๋ณ€์ˆ˜
    var calendarDictionary: [String : [FSCalendarModel]] = [:]
    
    guard let promise: [FSCalendarModel] = calendarDictionary[day] else { return UICollectionViewCell() }
    if promise[indexPath.row].isNotice == 0 {
      let cell: CalendarCollectionViewCell = collectionView.dequeueCell(forIndexPath: indexPath)
    	cell.calendar = promise[indexPath.row]
    	cell.fetchCalendar()
    	cell.fetchCategory()
    	cell.fetchTime()
    	return cell
    } else {
    	let cell: NoticeCollectionViewCell = collectionView.dequeueCell(forIndexPath: indexPath)
    	cell.calendar = promise[indexPath.row]
    	cell.fetchCalendar()
    	cell.fetchTime()
    	return cell
    }
  2. ํ•˜์šฐ์ง• ์ชฝ์ง€

    SegementSlide ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ „์ฒด ๋ทฐ๋ฅผ ๊ตฌ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

    header ๋ถ€๋ถ„์—๋Š” ์ œ๋ชฉ๊ณผ ๋ฌธ์˜ ๋‚ด์šฉ์ด ๋“ค์–ด๊ฐ€๊ณ  ์•„๋ž˜ ๋‘ ๊ฐœ์˜ ํƒญ์—๋Š” ๊ฐ๊ฐ ์ƒ์„ธ ์ •๋ณด์™€ ํ•˜์šฐ์ง• ์ชฝ์ง€๊ฐ€ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค.

    ํ•˜์šฐ์ง• ์ชฝ์ง€๊ฐ€ ์ง‘์ฃผ์ธ๊ณผ ์ž์ทจ์ƒ์˜ ์†Œํ†ต ํ๋ฆ„์„ ๋ณผ ์ˆ˜ ์žˆ๋Š” ํ•ต์‹ฌ ๊ธฐ๋Šฅ์ธ๋ฐ์š”.

    MessageViewController ๋‚ด์— ํ…Œ์ด๋ธ” ๋ทฐ๋ฅผ ๋„ฃ๊ณ  ๊ทธ ์…€ ์•ˆ์— ๋‹ค์‹œ ํ…Œ์ด๋ธ” ๋ทฐ๋ฅผ ๋„ฃ๋Š” ๋ฐฉ์‹์œผ๋กœ ์ง„ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

    ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž์ฒด์—์„œ ๋‚ด์žฅ ํ•จ์ˆ˜๋กœ ํƒญ ์•ˆ์˜ ๋ทฐ๊ฐ€ ํ…Œ์ด๋ธ”๋ทฐ๋กœ ๊ทธ๋ ค์ง€๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ ์ฒซ ๋ฒˆ ์งธ ์…€์— ๋‹ค์‹œ ํ…Œ์ด๋ธ”๋ทฐ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ๋ฐฉ์‹์„ ์„ ํƒํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

    ์…€ ๋งˆ๋‹ค ์–ด๋–ค ๋ทฐ๋ฅผ ๋„ฃ์–ด์ฃผ๊ณ  ๊ทธ ์…€ ์•ˆ์— ๋ฒ„ํŠผ์— ์–ด๋–ค ํ•จ์ˆ˜๋ฅผ ๋„ฃ๋Š”์ง€๊ฐ€ ๊ฐ€์žฅ ์ค‘์š”ํ•œ ๊ตฌํ˜„์‚ฌํ•ญ์ด์—ˆ๋Š”๋ฐ์š”.

    Datasource๋ฅผ ์ต์Šคํ…์…˜์œผ๋กœ ์„ ์–ธํ•˜์—ฌ ๊ทธ ์•ˆ์— ์…€๋งˆ๋‹ค์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ •ํ•ด์ค„ ์ˆ˜ ์žˆ๋Š” cellForRowAt ์ด ํฌํ•จ๋œ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ…์ŠคํŠธ๋ฅผ ๋ฐ”๊ฟ”์ฃผ๊ณ  ๋ฒ„ํŠผ์ด ๋ˆŒ๋ ธ์„ ๋•Œ selector๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    		let cell: MessageDetailTableViewCell = tableView.dequeueCell(forIndexPath: indexPath)
    		if self.userOrOwner == 0 {
    			if self.status[indexPath.row] == 0 {
    				cell.titleLabel.text = "๋ฌธ์˜์‚ฌํ•ญ์ด ๋“ฑ๋ก๋˜์—ˆ์–ด์š”!"
    				cell.contextLabel.attributedText = self.makeAttributed(
    					context: "์•„๋ž˜์˜ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ\n์•ฝ์†์‹œ๊ฐ„์„ ์ •ํ•ด๋ณด์„ธ์š”."
    				)
    				cell.transitionButton.addTarget(self,
    																				action: #selector(didTapConfirmButton(_:)),
    																				for: .touchUpInside
    				)
    				cell.transitionButton.setTitle("์•ฝ์† ํ™•์ •ํ•˜๊ธฐ", for: .normal)
    			}
    			else if self.status[indexPath.row] == 1 {
    				cell.titleLabel.text = "์•ฝ์†์ด ํ™•์ •๋˜์—ˆ์–ด์š”!"
    				var confirmedPromise = "\(self.confirmedPromiseOption)์˜ˆ์ •์ด์—์š”\n ์บ˜๋ฆฐ๋”์—์„œ ์ผ์ •์„ ํ™•์ธํ•ด๋ณด์„ธ์š”."
    				cell.contextLabel.attributedText = self.makeAttributed(context: confirmedPromise)				
    				cell.transitionButton.addTarget(self,
    																				action: #selector(didTapCalendarButton(_:)),
    																				for: .touchUpInside)
    				cell.transitionButton.setTitle("์บ˜๋ฆฐ๋” ๋ณด๊ธฐ", for: .normal)
    			}
    			else if self.status[indexPath.row] == 2 {
    				cell.titleLabel.text = "์•ฝ์† ์ˆ˜์ • ์š”์ฒญ์„ ๋ณด๋ƒˆ์–ด์š”!"
    				cell.contextLabel.attributedText = self.makeAttributed(
    					context: "์•ž์œผ๋กœ๋„ ํ•˜์šฐ์ง•๊ณผ ํ•จ๊ป˜\n์ž์ทจ์ƒ๊ณผ ์†Œํ†ตํ•ด๋ณด์„ธ์š”!"
    				)
    				cell.transitionButton.snp.makeConstraints {
    					$0.height.equalTo(0)
    				}
    			}
    			...

Extension์„ ํ†ตํ•ด ์ž‘์„ฑํ•œ ๋ฉ”์†Œ๋“œ ์„ค๋ช…

Extension ๋ชฉ์ 
UICollectionView+ ์ฝœ๋ ‰์…˜ ๋ทฐ ๊ด€๋ฆฌ
UICollectionViewCell+ ์ฝœ๋ ‰์…˜ ๋ทฐ ์…€ ๊ด€๋ฆฌ
UICollectionReusableView+ ์ฝœ๋ ‰์…˜ ๋ทฐ, ํ—ค๋” ํ‘ธํ„ฐ ๋ทฐ ๊ด€๋ฆฌ
UITableView+ ํ…Œ์ด๋ธ” ๋ทฐ ๊ด€๋ฆฌ
UITableViewCell+ ํ…Œ์ด๋ธ” ๋ทฐ ์…€ ๊ด€๋ฆฌ
UIColor+ color ์‚ฝ์ž…
UIView+ ๊ทธ๋ฆผ์ž ์ƒ์„ฑ ๋ทฐ, ์ปดํฌ๋„ŒํŠธ ์‚ฝ์ž…, ๋“ฑ๋“ฑ...
UIViewController+ ํ† ์Šคํ„ฐ ์ƒ์„ฑ / ๋ทฐ ์ปจํŠธ๋กค๋Ÿฌ ๊ด€๋ฆฌ
CALayer+ ๊ทธ๋ฆผ์ž ์ƒ์„ฑ
UIImage+ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์กฐ์ •
UIDatePicker+ DatePicker๋กœ ํ…์ŠคํŠธ ์ปฌ๋Ÿฌ ๋„ฃ๊ธฐ
UIImageView+ URL๋กœ ์ด๋ฏธ์ง€ ๋„ฃ๊ธฐ

๐Ÿ’ก์ƒˆ๋กญ๊ฒŒ ์•Œ๊ฒŒ ๋œ ๊ฒƒ

๊ณฝ๋ฏผ์ œ

CollectionView Cell์— Shadow๋ฅผ ๋„ฃ๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค๐Ÿ˜‹

extension CALayer {
	func applyShadow(
		color: UIColor = .black,
		alpha: Float = 0.1,
		x: CGFloat = 0,
		y: CGFloat = 0,
		blur: CGFloat = 8
	) {
		shadowColor = color.cgColor
		shadowOpacity = alpha
		shadowOffset = CGSize(width: x, height: y)
		shadowRadius = blur / 1.0
	}
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) ->
UICollectionViewCell {
	guard let cell = collectionView.dequeueReusableCell(
					withReuseIdentifier: "CollectionViewCell",
					for: indexPath) as? CollectionViewCell
	else {
		return UICollectionViewCell()
	}
	// collectionViewCell์— uiView outlet์„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
	cell.containerView.layer.applyShadow()
	cell.backgroundColor = .white
	cell.contentView.backgroundColor = UIColor.white

	return cell
}

๊น€์ฃผ์€

Expandable TableView๋ฅผ ๋งŒ๋“œ๋Š” ๋ฒ•์„ ์•Œ๊ฒŒ ๋˜์—ˆ์–ด์š”๐Ÿ‘ฉโ€๐Ÿ’ป

extension CommunicationViewController: UITableViewDelegate {
  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  	if indexPath.row == 0 {
  		if tableViewData[indexPath.section].opened == true {
  			tableViewData[indexPath.section].opened = false
  			communicationTableView.backgroundColor = .primaryGray
  			let sections = IndexSet(integer: indexPath.section)
  			tableView.reloadSections(sections, with: .none)
  		} else {
  			tableViewData[indexPath.section].opened = true
  			communicationTableView.backgroundColor = .primaryGray
  			let sections = IndexSet(integer: indexPath.section)
  			tableView.reloadSections(sections, with: .none) 
  		}
  		communicationTableView.reloadData()
  	} else {
  		let viewController = DetailViewController()
  		viewController.requestId = >tableViewData[indexPath.section].sectionData[indexPath.row-1].id
  		navigationController?.pushViewController(viewController, animated: true)
  	}
  }
}
}

๋…ธํ•œ์†”

RxMoya๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์„œ๋ฒ„ ํ†ต์‹ ํ•˜๋Š” ๋ฒ•์„ ์•Œ๊ฒŒ ๋˜์—ˆ์–ด์š”๐Ÿ™ƒ

detailProvider.rx.request(.homeDetail(id: requestId))
  		.asObservable()
  		.subscribe(onNext: { response in
  			do{
  				let json = JSON(response.data)
  				let decoder = JSONDecoder()
  				let data = try decoder.decode(ResponseType<Detail>.self,
  																			from: response.data)
  				
  				let result = data.data
  				self.statusModel.append(DetailStatus(
  					ownerStatus: json["data"]["Replies"][0]["owner_status"].arrayValue.map{$0.intValue},
  					userStatus: json["data"]["Replies"][0]["user_status"].arrayValue.map{$0.intValue},
  					id: json["data"]["Replies"][0]["id"].intValue
  				)
  				)
  				self.detailDataBind(result!)
  				let viewController = ContentViewController()
  				viewController.model = self.model
  				let statusViewController = MessageViewController()
  				self.idValue.id = data.data?.id ?? 11
  				
  				statusViewController.model = self.model
  				statusViewController.statusModel = self.statusModel
  				
  				//viewController.tableView.reloadData()
  				
  				statusViewController.tableView.reloadData()
  			} catch {
  				print(error)
  			}
  			
  		}, onError: { error in
  			print(error.localizedDescription)
  		}, onCompleted: {
  			self.headerViewLayout()
  			self.detailHeaderView.snp.makeConstraints{
  				$0.height.equalTo(130+self.contextHeight()*22)
  			}
  			self.detailHeaderView.reloadInputViews()
  		}).disposed(by: disposeBag)

๊น€ํƒœํ›ˆ

Then๊ณผ Snapkit์„ ์‚ฌ์šฉํ•ด์„œ UI๋ฅผ ๋งŒ๋“ค์—ˆ์–ด์š”๐ŸŽจ

  private var nextStep = UIButton().then{
  	$0.backgroundColor = .gray01
  	$0.setTitle("๋‹ค์Œ ๋‹จ๊ณ„", for: .normal)
  	$0.titleLabel?.font = UIFont(name: "AppleSDGothicNeo-Bold", size: 16)
  	$0.isEnabled = false
  	$0.setRounded(radius: 25)
  	$0.addTarget(self, action: #selector(nextButtonDidTapped), for: .touchUpInside)
  }
  	nextStep.snp.makeConstraints{
  		$0.top.equalTo(questionDescription.snp.bottom).offset(72)
  		$0.centerX.equalTo(view)
  		$0.width.equalTo(widthConstraintAmount(value: 255))
  		$0.height.equalTo(48)
  	}

TableView์˜ ๋†’์ด๋ฅผ ๋™์ ์œผ๋กœ ๊ตฌ์„ฑํ•ด๋ดค์–ด์š”๐Ÿคธโ€โ™€๏ธ

  func resetTableViewHeight() {
  	self.timeStampTableView.snp.updateConstraints{
  		$0.height.equalTo(CGFloat(70 * self.requestData.availableTimeList.count))
  	}
  	self.underGrayView.snp.updateConstraints{
  		$0.height.equalTo(CGFloat(70 * requestData.availableTimeList.count) + 300)
  	}
  }


  func addTimeStamp(sender : UIButton) {
  	resetPickerLayout()
  	resetTableViewHeight()
  	let isTableViewEmpty = requestData.availableTimeList.isEmpty
  	registerButton.isEnabled = isTableViewEmpty ? false : true
  	registerButton.backgroundColor = isTableViewEmpty ? .gray : .primaryOrange
  	tableViewBind()
  	timeStampTableView.reloadData()
  }

์˜ค์ค€ํ˜„

Dictionary ํƒ€์ž…์„ ์‚ฌ์šฉํ•ด๋ดค์Šต๋‹ˆ๋‹ค

๊ธฐ์กด์˜ ํ”„๋กœ์ ํŠธ์—์„œ ์‚ฌ์šฉ ํ•  ์ผ์ด ์—†์–ด ์‚ฌ์šฉํ•˜์ง€ ์•Š์•˜์ง€๋งŒ ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์—์„œ ์บ˜๋ฆฐ๋”๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด์„œ Dictionary ํƒ€์ž…์— ๋Œ€ํ•ด ๋‹ค๋ฃจ์–ด ๋ณด๋Š” ๊ธฐํšŒ๋ฅผ ๊ฐ€์ง€๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ตฌ์กฐ์ฒด๋ฅผ ๋‚ ์งœ String Key๊ฐ’์— ๋งž์ถฐ์ฃผ๋Š” ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค

		
for notice in data.notice {
	let when = "\(notice.year).\(notice.month).\(notice.day)"
	let model = FSCalendarModel(isNotice: notice.isNotice,
	 														id: notice.id,
															category: notice.category,
															solutionMethod: notice.solutionMethod,
															time: notice.time,
															title: notice.title,
															contents: notice.contents)ใ…ˆ
	calendarDictionary["\(when)"] = [model]
}
for promise in data.issue {
  let when = "\(promise.year).\(promise.month).\(promise.day)"
  let model = FSCalendarModel(isNotice: promise.isNotice,
                              id: promise.id,
															category: promise.category,
															solutionMethod: promise.solutionMethod,
															time: promise.time,
															title: promise.title,
															contents: promise.contents)
  if calendarDictionary[when]?.count == 0 {
    calendarDictionary["\(when)"] = [model]
	} else {
    calendarDictionary[when]?.append(model)
  }
}

ํŒ€์› ์—ญํ•  ๋ฐ ์†Œ๊ฐœ

์˜ค์ค€ํ˜„ ๋…ธํ•œ์†” ๊ณฝ๋ฏผ์ œ ๊น€์ฃผ์€ ๊น€ํƒœํ›ˆ

About

๐ŸŽํ•˜์šฐ์•„์š”? ์•”ํŒŒ์ธ๋•กํ์•ค์ฅฌ?๐ŸŽ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published