Skip to content

Commit

Permalink
Merge pull request AssistoLab#281 from RomanTysiachnik/master
Browse files Browse the repository at this point in the history
Fixed crash when import using SPM
  • Loading branch information
kevin-hirsch authored Feb 1, 2021
2 parents ca24284 + d040a7d commit 2ab6f6c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
15 changes: 9 additions & 6 deletions DropDown/resources/DropDownCell.xib
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="DropDownCell" customModule="DropDown" customModuleProvider="target">
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="DropDownCell" customModule="DropDown">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dhL-pA-i6q">
<rect key="frame" x="8" y="8" width="304" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="dhL-pA-i6q" secondAttribute="trailing" constant="8" id="Phk-No-PFh"/>
<constraint firstItem="dhL-pA-i6q" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="QIg-6Z-lbJ"/>
Expand All @@ -30,6 +32,7 @@
<connections>
<outlet property="optionLabel" destination="dhL-pA-i6q" id="1GT-db-EaA"/>
</connections>
<point key="canvasLocation" x="-16" y="2"/>
</view>
</objects>
</document>
11 changes: 10 additions & 1 deletion DropDown/src/DropDown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,22 @@ public final class DropDown: UIView {

Changing the cell nib automatically reloads the drop down.
*/
public var cellNib = UINib(nibName: "DropDownCell", bundle: Bundle(for: DropDownCell.self)) {
public var cellNib = UINib(nibName: "DropDownCell", bundle: bundle) {
didSet {
tableView.register(cellNib, forCellReuseIdentifier: DPDConstant.ReusableIdentifier.DropDownCell)
templateCell = nil
reloadAllComponents()
}
}

/// Correctly specify Bundle for Swift Packages
fileprivate static var bundle: Bundle {
#if SWIFT_PACKAGE
return Bundle.module
#else
return Bundle(for: DropDownCell.self)
#endif
}

//MARK: Content

Expand Down
17 changes: 12 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
// swift-tools-version:5.0
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "DropDown",
platforms: [
.iOS(.v8)
.iOS(.v9)
],
products: [
.library(
name: "DropDown",
targets: ["DropDown"])
targets: ["DropDown"]
)
],
targets: [
.target(
name: "DropDown",
path: "DropDown"
dependencies: [],
path: "DropDown",
exclude: ["Info.plist", "DropDown.h"],
resources: [
.process("DropDown/resources")
]
)
]
],
swiftLanguageVersions: [.v5]
)

0 comments on commit 2ab6f6c

Please # to comment.