Skip to content

Commit

Permalink
Merge pull request #1331 from wakmusic/1330-faq-numberoflines
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun authored Dec 8, 2024
2 parents 0d6b3bf + 30c3780 commit ec36407
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 58 deletions.
8 changes: 4 additions & 4 deletions Projects/Features/MyInfoFeature/Resources/Faq.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -96,7 +96,7 @@
<rect key="frame" x="0.0" y="165" width="393" height="653"/>
<color key="backgroundColor" name="gray100"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="QuestionTableViewCell" id="HOA-YT-EZE" customClass="QuestionTableViewCell" customModule="MyInfoFeature">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="FAQQuestionTableViewCell" id="HOA-YT-EZE" customClass="FAQQuestionTableViewCell" customModule="MyInfoFeature">
<rect key="frame" x="0.0" y="50" width="393" height="71.333335876464844"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="HOA-YT-EZE" id="FBx-qs-iBz">
Expand Down Expand Up @@ -158,7 +158,7 @@
<outlet property="titleLabel" destination="9G4-ac-ffu" id="pgL-cr-zgN"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnswerTableViewCell" id="FUV-q1-ysR" customClass="AnswerTableViewCell" customModule="MyInfoFeature">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="FAQAnswerTableViewCell" id="FUV-q1-ysR" customClass="FAQAnswerTableViewCell" customModule="MyInfoFeature">
<rect key="frame" x="0.0" y="121.33333587646484" width="393" height="49.333332061767578"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="FUV-q1-ysR" id="Oz4-am-izT">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Utility
public final class FaqContentViewController: UIViewController, ViewControllerFromStoryBoard {
@IBOutlet weak var tableView: UITableView!

var viewModel: QnaContentViewModel!
var viewModel: FAQContentViewModel!

override public func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -21,7 +21,7 @@ public final class FaqContentViewController: UIViewController, ViewControllerFro
navigationController?.interactivePopGestureRecognizer?.delegate = nil // 스와이프로 뒤로가기
}

public static func viewController(viewModel: QnaContentViewModel) -> FaqContentViewController {
public static func viewController(viewModel: FAQContentViewModel) -> FaqContentViewController {
let viewController = FaqContentViewController.viewController(storyBoardName: "Faq", bundle: Bundle.module)
viewController.viewModel = viewModel
return viewController
Expand Down Expand Up @@ -71,12 +71,16 @@ extension FaqContentViewController: UITableViewDataSource {

public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let questionCell = tableView
.dequeueReusableCell(withIdentifier: "QuestionTableViewCell", for: indexPath) as? QuestionTableViewCell
.dequeueReusableCell(
withIdentifier: "FAQQuestionTableViewCell",
for: indexPath
) as? FAQQuestionTableViewCell
else {
return UITableViewCell()
}
guard let answerCell = tableView
.dequeueReusableCell(withIdentifier: "AnswerTableViewCell", for: indexPath) as? AnswerTableViewCell else {
.dequeueReusableCell(withIdentifier: "FAQAnswerTableViewCell", for: indexPath) as? FAQAnswerTableViewCell
else {
return UITableViewCell()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import RxRelay
import RxSwift
import Utility

public final class QnaContentViewModel: ViewModelType {
public final class FAQContentViewModel: ViewModelType {
var disposeBag = DisposeBag()
var dataSource: [FaqEntity]

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import DesignSystem
import FaqDomainInterface
import UIKit

final class FAQAnswerTableViewCell: UITableViewCell {
@IBOutlet weak var answerLabel: UILabel!

override func awakeFromNib() {
super.awakeFromNib()
if Thread.isMainThread {
MainActor.assumeIsolated {
answerLabel.font = DesignSystemFontFamily.Pretendard.medium.font(size: 14)
answerLabel.setTextWithAttributes(kernValue: -0.5, lineSpacing: 6)
}
} else {
Task { @MainActor in
answerLabel.font = DesignSystemFontFamily.Pretendard.medium.font(size: 14)
answerLabel.setTextWithAttributes(kernValue: -0.5, lineSpacing: 6)
}
}
}
}

extension FAQAnswerTableViewCell {
public func update(model: FaqEntity) {
answerLabel.text = model.answer
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import DesignSystem
import FaqDomainInterface
import UIKit

final class FAQQuestionTableViewCell: UITableViewCell {
@IBOutlet weak var categoryLabel: UILabel!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var expandImageView: UIImageView!

override func awakeFromNib() {
super.awakeFromNib()
if Thread.isMainThread {
MainActor.assumeIsolated {
categoryLabel.font = DesignSystemFontFamily.Pretendard.light.font(size: 12)
categoryLabel.setTextWithAttributes(kernValue: -0.5)
titleLabel.font = DesignSystemFontFamily.Pretendard.medium.font(size: 16)
titleLabel.setTextWithAttributes(kernValue: -0.5, lineSpacing: 5)
}
} else {
Task { @MainActor in
categoryLabel.font = DesignSystemFontFamily.Pretendard.light.font(size: 12)
categoryLabel.setTextWithAttributes(kernValue: -0.5)
titleLabel.font = DesignSystemFontFamily.Pretendard.medium.font(size: 16)
titleLabel.setTextWithAttributes(kernValue: -0.5, lineSpacing: 5)
}
}
}
}

extension FAQQuestionTableViewCell {
func update(model: FaqEntity) {
categoryLabel.text = model.category
titleLabel.text = model.question
expandImageView.image = model.isOpen ? DesignSystemAsset.Navigation.fold.image : DesignSystemAsset.Navigation
.close.image
}
}

This file was deleted.

0 comments on commit ec36407

Please sign in to comment.