Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 4.2 compatibility #28

Merged
merged 1 commit into from
Dec 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions Source/FAQView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ extension FAQView: UITableViewDelegate, UITableViewDataSource {
if ((height) != nil) {
return CGFloat(height as! CGFloat)
} else {
return UITableViewAutomaticDimension
#if swift(>=4.2)
return UITableView.automaticDimension
#else
return UITableViewAutomaticDimension
#endif
}
}

Expand Down Expand Up @@ -383,17 +387,27 @@ class FAQViewCell: UITableViewCell {
}()

// MARK: Initialization

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
#if swift(>=4.2)
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
viewSetup()
}
#else
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
viewSetup()
}
#endif

private func viewSetup() {
selectionSetup()
self.containerView.addSubview(indicatorImageView)
contentView.addSubview(questionLabel)
contentView.addSubview(answerTextView)
contentView.addSubview(containerView)
addLabelConstraints()
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down