Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

update to swift 4.2 #246

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Sources/Internal/NSAttributedStringExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension NSAttributedString {

/// Returns a new NSAttributedString with a given font and the same attributes.
func with(font: UIFont) -> NSAttributedString {
let fontAttribute = [NSAttributedStringKey.font: font]
let fontAttribute = [NSAttributedString.Key.font: font]
let attributedTextWithFont = NSMutableAttributedString(string: string, attributes: fontAttribute)
let fullRange = NSMakeRange(0, (string as NSString).length)
attributedTextWithFont.beginEditing()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Layouts/ButtonLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public enum ButtonLayoutType {
case infoDark
case contactAdd

public var buttonType: UIButtonType {
public var buttonType: UIButton.ButtonType {
switch (self) {
case .custom:
return .custom
Expand Down
2 changes: 1 addition & 1 deletion Sources/Layouts/TextViewLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private extension Text {
case .attributed(_):
let text = Text.attributed(NSAttributedString(
string: spaceString,
attributes: [NSAttributedStringKey.font: font]))
attributes: [NSAttributedString.Key.font: font]))
size = text.textSize(within: maxSize, font: font)

case .unattributed(_):
Expand Down
2 changes: 1 addition & 1 deletion Sources/Text.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public enum Text {
if text.isEmpty {
return .zero
}
size = text.boundingRect(with: maxSize, options: options, attributes: [NSAttributedStringKey.font: font], context: nil).size
size = text.boundingRect(with: maxSize, options: options, attributes: [NSAttributedString.Key.font: font], context: nil).size
}
// boundingRect(with:options:attributes:) returns size to a precision of hundredths of a point,
// but UILabel only returns sizes with a point precision of 1/screenDensity.
Expand Down
4 changes: 2 additions & 2 deletions Sources/Views/ReloadableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ extension UICollectionView: ReloadableView {
@objc
open func registerViews(withReuseIdentifier reuseIdentifier: String) {
register(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)
register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: reuseIdentifier)
register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: reuseIdentifier)
register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: reuseIdentifier)
register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: reuseIdentifier)
}

@objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ extension ReloadableViewLayoutAdapter: UICollectionViewDataSource {
let view = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: reuseIdentifier, for: indexPath)
let arrangement: LayoutArrangement?
switch kind {
case UICollectionElementKindSectionHeader:
case UICollectionView.elementKindSectionHeader:
arrangement = currentArrangement[indexPath.section].header
case UICollectionElementKindSectionFooter:
case UICollectionView.elementKindSectionFooter:
arrangement = currentArrangement[indexPath.section].footer
default:
arrangement = nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/Views/StackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private struct ViewLayout: ConfigurableLayout {
return Flexibility(horizontal: horizontal, vertical: vertical)
}

private func flexForAxis(_ axis: UILayoutConstraintAxis) -> Flexibility.Flex {
private func flexForAxis(_ axis: NSLayoutConstraint.Axis) -> Flexibility.Flex {
switch view.contentHuggingPriority(for: .horizontal) {
case UILayoutPriority.required:
return nil
Expand Down