From df87e0a62f256fb719835f035181f9725317b4b7 Mon Sep 17 00:00:00 2001 From: Heba Atallah Date: Sun, 13 Jan 2019 15:59:12 +0200 Subject: [PATCH] update to swift 4.2 --- Sources/Internal/NSAttributedStringExtension.swift | 2 +- Sources/Layouts/ButtonLayout.swift | 2 +- Sources/Layouts/TextViewLayout.swift | 2 +- Sources/Text.swift | 2 +- Sources/Views/ReloadableView.swift | 4 ++-- .../Views/ReloadableViewLayoutAdapter+UICollectionView.swift | 4 ++-- Sources/Views/StackView.swift | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/Internal/NSAttributedStringExtension.swift b/Sources/Internal/NSAttributedStringExtension.swift index 51a7b0f0..673f789e 100644 --- a/Sources/Internal/NSAttributedStringExtension.swift +++ b/Sources/Internal/NSAttributedStringExtension.swift @@ -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() diff --git a/Sources/Layouts/ButtonLayout.swift b/Sources/Layouts/ButtonLayout.swift index f1189548..35e6dbf1 100644 --- a/Sources/Layouts/ButtonLayout.swift +++ b/Sources/Layouts/ButtonLayout.swift @@ -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 diff --git a/Sources/Layouts/TextViewLayout.swift b/Sources/Layouts/TextViewLayout.swift index b71c8ac8..5f43adf7 100644 --- a/Sources/Layouts/TextViewLayout.swift +++ b/Sources/Layouts/TextViewLayout.swift @@ -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(_): diff --git a/Sources/Text.swift b/Sources/Text.swift index 0166104f..e50e1d33 100644 --- a/Sources/Text.swift +++ b/Sources/Text.swift @@ -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. diff --git a/Sources/Views/ReloadableView.swift b/Sources/Views/ReloadableView.swift index 4fb7f55c..ddb7b257 100644 --- a/Sources/Views/ReloadableView.swift +++ b/Sources/Views/ReloadableView.swift @@ -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 diff --git a/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift b/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift index 985cd0fa..87f2bcab 100644 --- a/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift +++ b/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift @@ -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 diff --git a/Sources/Views/StackView.swift b/Sources/Views/StackView.swift index 4fdffed9..94d4bfc4 100644 --- a/Sources/Views/StackView.swift +++ b/Sources/Views/StackView.swift @@ -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