Skip to content

Commit

Permalink
Add SPM support for included UI elements (#74)
Browse files Browse the repository at this point in the history
* Update swift-tools to 5.3

* Move storyboards into resources

# Conflicts:
#	Package.swift

* Add resolvedBundle extension

* Fix enum typo

* Extract bundle extensions to own file

* Update to use resolvedBundle

* Turn off inherit from target

* Update module

* Remove module references

* Add module specifications

* Update bundle reference
  • Loading branch information
ltsuchiya committed Jun 8, 2021
1 parent b8e21d9 commit 9dcdd75
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 57 deletions.
8 changes: 6 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.0
// swift-tools-version:5.3

import PackageDescription

Expand All @@ -9,6 +9,10 @@ let package = Package(
targets: ["LifetimeTracker"]),
],
targets: [
.target(name: "LifetimeTracker", path: "Sources")
.target(name: "LifetimeTracker",
path: "Sources",
resources: [
.process("Resources")
])
]
)
20 changes: 20 additions & 0 deletions Sources/Bundle+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// File.swift
//
//
// Created by Leo Tsuchiya on 6/6/21.
//

import Foundation

extension Bundle {

/// Returns a package manager appropriate `Bundle`.
static var resolvedBundle: Bundle {
#if SWIFT_PACKAGE
return Bundle.module
#else
return Bundle(for: self)
#endif
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" 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.Storyboard.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="14088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -23,7 +20,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WeQ-Il-Fvf">
<rect key="frame" x="0.5" y="0.0" width="375" height="128"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="128"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LTP-HG-KtQ" userLabel="Header View">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
Expand All @@ -38,17 +35,17 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" text="No issues detected." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kui-Kg-jAG" userLabel="Summary">
<rect key="frame" x="44" y="14.5" width="301" height="16"/>
<rect key="frame" x="44" y="14" width="301" height="16"/>
<accessibility key="accessibilityConfiguration" identifier="LifetimeTracker.summaryLabel"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="4yh-Ze-M0v" userLabel="Move Icon View">
<rect key="frame" x="350" y="14" width="15" height="15"/>
<rect key="frame" x="350" y="14.5" width="15" height="15"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fIn-4l-KRY">
<rect key="frame" x="0.0" y="0.0" width="15" height="3"/>
<color key="backgroundColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<color key="backgroundColor" systemColor="scrollViewTexturedBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="3" id="O64-4P-dZA"/>
</constraints>
Expand All @@ -60,7 +57,7 @@
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XOT-qD-gYn">
<rect key="frame" x="0.0" y="6" width="15" height="3"/>
<color key="backgroundColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<color key="backgroundColor" systemColor="scrollViewTexturedBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="3" id="Km8-AI-7RG"/>
</constraints>
Expand All @@ -72,7 +69,7 @@
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YAj-Vi-Uyt">
<rect key="frame" x="0.0" y="12" width="15" height="3"/>
<color key="backgroundColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<color key="backgroundColor" systemColor="scrollViewTexturedBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="3" id="PEN-TQ-2T5"/>
</constraints>
Expand Down Expand Up @@ -121,7 +118,7 @@
</connections>
</containerView>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<color key="backgroundColor" systemColor="groupTableViewBackgroundColor"/>
<constraints>
<constraint firstItem="8Zo-fx-aQl" firstAttribute="leading" secondItem="WeQ-Il-Fvf" secondAttribute="leading" id="DBV-qq-eKM"/>
<constraint firstItem="LTP-HG-KtQ" firstAttribute="top" secondItem="WeQ-Il-Fvf" secondAttribute="top" id="J7O-5P-vWp"/>
Expand Down Expand Up @@ -166,4 +163,12 @@
<point key="canvasLocation" x="690" y="251"/>
</scene>
</scenes>
<resources>
<systemColor name="groupTableViewBackgroundColor">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="scrollViewTexturedBackgroundColor">
<color red="0.43529411764705878" green="0.44313725490196082" blue="0.47450980392156861" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="1We-aU-RGw">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="1We-aU-RGw">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Lifetime Tracker List View Controller-->
<scene sceneID="1D4-WH-aQX">
<objects>
<viewController storyboardIdentifier="LifetimeTrackerListViewController" automaticallyAdjustsScrollViewInsets="NO" id="hGY-sM-6JX" customClass="LifetimeTrackerListViewController" customModule="LifetimeTracker" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="LifetimeTrackerListViewController" automaticallyAdjustsScrollViewInsets="NO" id="hGY-sM-6JX" customClass="LifetimeTrackerListViewController" customModule="LifetimeTracker" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="L1p-ji-3cZ"/>
<viewControllerLayoutGuide type="bottom" id="EKh-Hq-gM8"/>
Expand All @@ -24,7 +20,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6K3-PR-mfM">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<connections>
<segue destination="Ltv-l9-n8R" kind="embed" identifier="embedDashboardTableViewController" id="aPS-h2-jLg"/>
</connections>
Expand Down Expand Up @@ -61,7 +57,7 @@
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="1We-aU-RGw" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="fX5-rG-j3M">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
Expand Down
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.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="hzA-q0-fGF">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="hzA-q0-fGF">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Dashboard Table View Controller-->
<scene sceneID="0Ci-1b-V1X">
<objects>
<viewController id="hzA-q0-fGF" customClass="DashboardTableViewController" customModule="LifetimeTracker" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="hzA-q0-fGF" customClass="DashboardTableViewController" customModule="LifetimeTracker" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="yCy-bM-UEU"/>
<viewControllerLayoutGuide type="bottom" id="5Km-Fw-40u"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" 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="13173"/>
<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"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="lifetimeTrackerDashboardTableViewCell" id="R1a-B8-7PV" customClass="DashboardTableViewCell" customModule="LifetimeTracker" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="lifetimeTrackerDashboardTableViewCell" id="R1a-B8-7PV" customClass="DashboardTableViewCell" customModule="LifetimeTracker">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="R1a-B8-7PV" id="kOr-bk-4m8">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="etI-6S-9ZF">
<rect key="frame" x="20" y="14.5" width="340" height="14.5"/>
<rect key="frame" x="20" y="15" width="340" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DZX-2O-J9V">
<rect key="frame" x="0.0" y="0.0" width="5" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="5" height="44"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="5" id="lRd-BC-5eS"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="C1e-R9-e6C" userLabel="Indicator View">
<rect key="frame" x="5" y="0.0" width="5" height="43.5"/>
<rect key="frame" x="5" y="0.0" width="5" height="44"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="5" id="IPE-Si-up8"/>
<constraint firstAttribute="width" constant="5" id="gSU-LR-Ab4"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="tableCellGroupedBackgroundColor"/>
<color key="backgroundColor" systemColor="tableCellGroupedBackgroundColor"/>
<constraints>
<constraint firstItem="C1e-R9-e6C" firstAttribute="top" secondItem="kOr-bk-4m8" secondAttribute="top" id="3wL-ll-pA7"/>
<constraint firstItem="etI-6S-9ZF" firstAttribute="top" relation="greaterThanOrEqual" secondItem="kOr-bk-4m8" secondAttribute="top" id="656-Ke-1dx"/>
Expand All @@ -64,4 +62,9 @@
<point key="canvasLocation" x="-243.5" y="-45"/>
</tableViewCell>
</objects>
<resources>
<systemColor name="tableCellGroupedBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

0 comments on commit 9dcdd75

Please sign in to comment.