From 94b77373e83e65353ae74b3081b0c3bfc3501537 Mon Sep 17 00:00:00 2001 From: nakajijapan Date: Sat, 18 Feb 2017 18:59:37 +0900 Subject: [PATCH] constraints is never used --- Sources/Classes/ImageView.swift | 10 ++++------ Sources/Classes/ViewController.swift | 16 ++++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Sources/Classes/ImageView.swift b/Sources/Classes/ImageView.swift index 053d366..aa327f4 100644 --- a/Sources/Classes/ImageView.swift +++ b/Sources/Classes/ImageView.swift @@ -106,24 +106,22 @@ class ImageView: UIView { private func layoutScrollView() { scrollView.translatesAutoresizingMaskIntoConstraints = false - let constraints = [ + [ scrollView.topAnchor.constraint(equalTo: topAnchor, constant: 0.0), scrollView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0.0), scrollView.rightAnchor.constraint(equalTo: rightAnchor, constant: 0.0), scrollView.leftAnchor.constraint(equalTo: leftAnchor, constant: 0.0), - ].map { $0.isActive = true } + ].forEach { $0.isActive = true } } private func layoutProgressView() { - progressView.translatesAutoresizingMaskIntoConstraints = false - - let constraints = [ + [ progressView.heightAnchor.constraint(equalToConstant: 40.0), progressView.widthAnchor.constraint(equalToConstant: 40.0), progressView.centerXAnchor.constraint(lessThanOrEqualTo: centerXAnchor, constant: 1.0), progressView.centerYAnchor.constraint(lessThanOrEqualTo: centerYAnchor, constant: 1.0), - ].map { $0.isActive = true } + ].forEach { $0.isActive = true } } func loadImage(imageURL: URL) { diff --git a/Sources/Classes/ViewController.swift b/Sources/Classes/ViewController.swift index f8bcea8..0a1a4a1 100644 --- a/Sources/Classes/ViewController.swift +++ b/Sources/Classes/ViewController.swift @@ -231,41 +231,41 @@ fileprivate extension ViewController { func layoutScrollView() { scrollView.translatesAutoresizingMaskIntoConstraints = false - let constraints = [ + [ scrollView.topAnchor.constraint(equalTo: view.topAnchor, constant: 0.0), scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0.0), scrollView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0.0), scrollView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0.0), - ].map { $0.isActive = true } + ].forEach { $0.isActive = true } } func layoutCloseButton() { closeButton.translatesAutoresizingMaskIntoConstraints = false - let constraints = [ + [ closeButton.topAnchor.constraint(equalTo: view.topAnchor, constant: 0.0), closeButton.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0.0), closeButton.heightAnchor.constraint(equalToConstant: 52.0), closeButton.widthAnchor.constraint(equalToConstant: 52.0), - ].map { $0.isActive = true } + ].forEach { $0.isActive = true } } func layoutPageControl() { pageControl.translatesAutoresizingMaskIntoConstraints = false - let constraints = [ + [ pageControl.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0.0), pageControl.centerXAnchor.constraint(equalTo: view.centerXAnchor), pageControl.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0.0), pageControl.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0.0), - ].map { $0.isActive = true } + ].forEach { $0.isActive = true } } func layoutCaptionLabel() { captionLabel.translatesAutoresizingMaskIntoConstraints = false - let constraints = [ + [ captionLabel.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -32.0), captionLabel.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -16.0), captionLabel.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 16.0), - ].map { $0.isActive = true } + ].forEach { $0.isActive = true } } }