Skip to content

Commit 0331522

Browse files
committed
Update loading images by url.
Update search imageViews contentMode.
1 parent a36da6a commit 0331522

6 files changed

Lines changed: 34 additions & 34 deletions

File tree

Catalog/Core/Extensions/UIImageView+Load.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import Foundation
1010
import UIKit
1111

1212
extension UIImageView {
13+
1314
func load(url: URL) {
14-
DispatchQueue.global().async { [weak self] in
15-
if let data = try? Data(contentsOf: url) {
16-
if let image = UIImage(data: data) {
17-
DispatchQueue.main.async {
18-
self?.image = image
19-
}
15+
let request = URLRequest(url: url)
16+
URLSession.shared.dataTask(with: request) { [weak self] data, response, error in
17+
if let data = data, let image = UIImage(data: data) {
18+
DispatchQueue.main.async {
19+
self?.image = image
2020
}
2121
}
22-
}
22+
}.resume()
2323
}
2424
}
2525

Catalog/Core/PersonDatabase/DatabaseSearchViewController.xib

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22113.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_1" orientation="landscape" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22089.1"/>
77
<capability name="Named colors" minToolsVersion="9.0"/>
88
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
99
<capability name="System colors in document resources" minToolsVersion="11.0"/>
@@ -26,19 +26,19 @@
2626
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2727
<subviews>
2828
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="uIa-mF-Im7">
29-
<rect key="frame" x="0.0" y="48" width="896" height="332"/>
29+
<rect key="frame" x="48" y="0.0" width="800" height="393"/>
3030
<subviews>
3131
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vwE-tS-5eB">
32-
<rect key="frame" x="0.0" y="0.0" width="277" height="332"/>
32+
<rect key="frame" x="0.0" y="0.0" width="338" height="393"/>
3333
<subviews>
3434
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qSO-He-dF1">
35-
<rect key="frame" x="0.0" y="282" width="277" height="50"/>
35+
<rect key="frame" x="0.0" y="343" width="338" height="50"/>
3636
<subviews>
3737
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="IT8-gr-Xsv">
38-
<rect key="frame" x="5" y="0.0" width="267" height="50"/>
38+
<rect key="frame" x="5" y="0.0" width="328" height="50"/>
3939
<subviews>
4040
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4rE-8B-rsV">
41-
<rect key="frame" x="0.0" y="0.0" width="131" height="50"/>
41+
<rect key="frame" x="0.0" y="0.0" width="161.5" height="50"/>
4242
<state key="normal" title="Button"/>
4343
<buttonConfiguration key="configuration" style="plain" title="Browse image">
4444
<backgroundConfiguration key="background">
@@ -52,7 +52,7 @@
5252
</connections>
5353
</button>
5454
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oc2-Zc-X87">
55-
<rect key="frame" x="136" y="0.0" width="131" height="50"/>
55+
<rect key="frame" x="166.5" y="0.0" width="161.5" height="50"/>
5656
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
5757
<state key="normal" title="Search"/>
5858
<buttonConfiguration key="configuration" style="plain" title="Search">
@@ -79,8 +79,8 @@
7979
<constraint firstAttribute="trailing" secondItem="IT8-gr-Xsv" secondAttribute="trailing" constant="5" id="s9C-RR-URl"/>
8080
</constraints>
8181
</view>
82-
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person_placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="Htm-JJ-HnZ">
83-
<rect key="frame" x="0.0" y="0.0" width="277" height="277"/>
82+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person_placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="Htm-JJ-HnZ">
83+
<rect key="frame" x="0.0" y="0.0" width="338" height="338"/>
8484
<color key="backgroundColor" systemColor="systemGray5Color"/>
8585
<constraints>
8686
<constraint firstAttribute="width" secondItem="Htm-JJ-HnZ" secondAttribute="height" multiplier="1:1" id="AKi-Px-Iba"/>
@@ -98,7 +98,7 @@
9898
</constraints>
9999
</view>
100100
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="TbZ-aw-XM0">
101-
<rect key="frame" x="283" y="0.0" width="613" height="332"/>
101+
<rect key="frame" x="344" y="0.0" width="456" height="393"/>
102102
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
103103
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="asm-md-1x9">
104104
<size key="itemSize" width="128" height="128"/>
@@ -115,7 +115,7 @@
115115
<variation key="heightClass=compact-widthClass=regular" axis="horizontal"/>
116116
</stackView>
117117
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="hNq-Ft-lWU">
118-
<rect key="frame" x="579.5" y="204" width="20" height="20"/>
118+
<rect key="frame" x="610" y="186.5" width="20" height="20"/>
119119
</activityIndicatorView>
120120
</subviews>
121121
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
@@ -140,7 +140,7 @@
140140
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
141141
</systemColor>
142142
<systemColor name="systemGray5Color">
143-
<color red="0.89803921568627454" green="0.89803921568627454" blue="0.91764705882352937" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
143+
<color red="0.8980392157" green="0.8980392157" blue="0.91764705879999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
144144
</systemColor>
145145
</resources>
146146
</document>

Catalog/Core/PersonDatabase/DatabaseUpdatePersonViewController.xib

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22113.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_12" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22089.1"/>
77
<capability name="Named colors" minToolsVersion="9.0"/>
88
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
99
<capability name="System colors in document resources" minToolsVersion="11.0"/>
@@ -27,7 +27,7 @@
2727
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2828
<subviews>
2929
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="HVh-nJ-J1x">
30-
<rect key="frame" x="0.0" y="79" width="383" height="155"/>
30+
<rect key="frame" x="0.0" y="79.000000000000014" width="383" height="189.33333333333337"/>
3131
<subviews>
3232
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ua9-6y-woi">
3333
<rect key="frame" x="48" y="0.0" width="287" height="37.666666666666664"/>
@@ -41,7 +41,7 @@
4141
</connections>
4242
</textField>
4343
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="surname" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aca-sF-gVT">
44-
<rect key="frame" x="48" y="52.666666666666657" width="287" height="37.333333333333343"/>
44+
<rect key="frame" x="48" y="70" width="287" height="37.333333333333343"/>
4545
<constraints>
4646
<constraint firstAttribute="height" constant="37.329999999999998" id="oCV-7U-hy1"/>
4747
</constraints>
@@ -52,7 +52,7 @@
5252
</connections>
5353
</textField>
5454
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ugH-EA-DEY">
55-
<rect key="frame" x="48" y="105" width="287" height="50"/>
55+
<rect key="frame" x="48" y="139.33333333333334" width="287" height="50"/>
5656
<constraints>
5757
<constraint firstAttribute="height" constant="50" id="s1b-Gw-LGB"/>
5858
</constraints>
@@ -76,13 +76,13 @@
7676
</constraints>
7777
</stackView>
7878
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="s6b-Lw-shR">
79-
<rect key="frame" x="0.0" y="244" width="393" height="574"/>
79+
<rect key="frame" x="0.0" y="278.33333333333331" width="393" height="539.66666666666674"/>
8080
<subviews>
8181
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="q37-cx-sTW">
82-
<rect key="frame" x="0.0" y="0.0" width="393" height="574"/>
82+
<rect key="frame" x="0.0" y="0.0" width="393" height="539.66666666666663"/>
8383
<subviews>
8484
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Wmi-Wx-RV8">
85-
<rect key="frame" x="0.0" y="0.0" width="393" height="494"/>
85+
<rect key="frame" x="0.0" y="0.0" width="393" height="459.66666666666663"/>
8686
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
8787
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="wOO-hX-Q6R">
8888
<size key="itemSize" width="128" height="128"/>
@@ -96,7 +96,7 @@
9696
</connections>
9797
</collectionView>
9898
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="siF-qd-jRY">
99-
<rect key="frame" x="0.0" y="504" width="393" height="70"/>
99+
<rect key="frame" x="0.0" y="469.66666666666669" width="393" height="70.000000000000057"/>
100100
<subviews>
101101
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="buk-N4-OnK">
102102
<rect key="frame" x="49" y="10" width="295" height="50"/>

Catalog/Core/PersonDatabase/Supplementary/PersonImageCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PersonImageCell: UICollectionViewCell {
2525
}
2626

2727
private func setup() {
28-
imageView.contentMode = .scaleAspectFill
28+
imageView.contentMode = .scaleAspectFit
2929
imageView.clipsToBounds = true
3030
contentView.addSubview(imageView)
3131
}

Catalog/Core/PersonDatabase/Supplementary/SearchPersonImageCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SearchPersonImageCell: UICollectionViewCell {
3131
}
3232

3333
private func setup() {
34-
imageView.contentMode = .scaleAspectFill
34+
imageView.contentMode = .scaleAspectFit
3535
imageView.clipsToBounds = true
3636

3737
stackContainer.backgroundColor = UIColor.black.withAlphaComponent(0.6)

Catalog/Core/PersonDatabase/Supplementary/UpdatePersonCell.xib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22113.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_0" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22089.1"/>
77
<capability name="Named colors" minToolsVersion="9.0"/>
88
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -18,7 +18,7 @@
1818
<rect key="frame" x="0.0" y="0.0" width="233" height="184"/>
1919
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
2020
<subviews>
21-
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person_placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="q4i-tv-xEJ">
21+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person_placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="q4i-tv-xEJ">
2222
<rect key="frame" x="0.0" y="0.0" width="233" height="184"/>
2323
</imageView>
2424
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SpF-5w-e5j">

0 commit comments

Comments
 (0)