Skip to content

Commit

Permalink
Fixed crash when opening XIB.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabmarfer committed Aug 13, 2021
1 parent 96cda94 commit 9d75233
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
8 changes: 7 additions & 1 deletion ImageViewer/ImageViewerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ public final class ImageViewerController: UIViewController {
@IBOutlet fileprivate var scrollView: UIScrollView!
@IBOutlet fileprivate var imageView: UIImageView!
@IBOutlet fileprivate var activityIndicator: UIActivityIndicatorView!
@IBOutlet fileprivate var closeButton: UIButton! {
didSet {
let closeImage = UIImage(named: "closeButton", in: Bundle.module, compatibleWith: nil)
closeButton.setImage(closeImage, for: .normal)
}
}

fileprivate var transitionHandler: ImageViewerTransitioningHandler?
fileprivate let configuration: ImageViewerConfiguration?
Expand All @@ -15,7 +21,7 @@ public final class ImageViewerController: UIViewController {

public init(configuration: ImageViewerConfiguration?) {
self.configuration = configuration
super.init(nibName: String(describing: type(of: self)), bundle: Bundle(for: type(of: self)))
super.init(nibName: "ImageViewerController", bundle: .module)

modalPresentationStyle = .overFullScreen
modalTransitionStyle = .crossDissolve
Expand Down
17 changes: 6 additions & 11 deletions ImageViewer/Resources/ImageViewerController.xib
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ImageViewerController" customModule="SimpleImageViewer" customModuleProvider="target">
<connections>
<outlet property="activityIndicator" destination="oPl-2f-Knx" id="GOD-eG-o96"/>
<outlet property="closeButton" destination="Wsy-fe-raz" id="a3H-nt-lws"/>
<outlet property="imageView" destination="rHA-5m-kkS" id="V86-k1-pPH"/>
<outlet property="scrollView" destination="cQD-2Q-pvo" id="M6k-QU-OVY"/>
<outlet property="view" destination="iN0-l3-epB" id="bEt-1B-b5l"/>
Expand Down Expand Up @@ -45,12 +43,12 @@
<rect key="frame" x="169" y="315" width="37" height="37"/>
</activityIndicatorView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wsy-fe-raz">
<rect key="frame" x="0.0" y="20" width="44" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="bXU-O2-lam"/>
<constraint firstAttribute="width" constant="44" id="xTg-TJ-eL3"/>
</constraints>
<state key="normal" image="closeButton">
<state key="normal">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
Expand All @@ -74,7 +72,4 @@
<point key="canvasLocation" x="33.5" y="54.5"/>
</view>
</objects>
<resources>
<image name="closeButton" width="13" height="13"/>
</resources>
</document>
12 changes: 9 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
// swift-tools-version:5.0
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "SimpleImageViewer",
products: [
.library(name: "SimpleImageViewer", targets: ["SimpleImageViewer"]),
.library(name: "SimpleImageViewer",
targets: ["SimpleImageViewer"]),
],
dependencies : [
],
targets: [
.target(name: "SimpleImageViewer", dependencies: [], path: "ImageViewer"),
.target(name: "SimpleImageViewer",
dependencies: [],
path: "ImageViewer",
resources: [
.process("Resources")
])
]
)

0 comments on commit 9d75233

Please sign in to comment.