Skip to content

Commit

Permalink
Merge pull request #287 from tilltue/spm
Browse files Browse the repository at this point in the history
SPM Support
  • Loading branch information
tilltue committed Sep 20, 2020
2 parents dfba254 + df497ec commit b6b7b9c
Show file tree
Hide file tree
Showing 21 changed files with 202 additions and 25 deletions.
31 changes: 31 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "TLPhotoPicker",
platforms: [
.iOS(.v10)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "TLPhotoPicker",
targets: ["TLPhotoPicker"]
),
],
targets: [
.target(
name: "TLPhotoPicker",
path: "TLPhotoPicker",
exclude: ["Classes/TLBundle.swift"],
resources: [
.process("TLPhotoPicker/Classes/TLCollectionTableViewCell.xib"),
.process("TLPhotoPicker/Classes/TLPhotoCollectionViewCell.xib"),
.process("TLPhotoPicker/Classes/TLPhotosPickerViewController.xib"),
.process("TLPhotoPicker/Assets.xcassets")
]
)
]
)
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ Specify TLPhotoPicker into your project's Cartfile:
github "tilltue/TLPhotoPicker"
```

### Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but TLPhotoPicker does support its use on supported platforms.

Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
.package(url: "https://github.com/tilltue/TLPhotoPicker.git", .upToNextMajor(from: "2.1.0"))
]


> Don't forget the Privacy Description in `info.plist`.
<img src="./Images/Privacy.png">
Expand Down
2 changes: 1 addition & 1 deletion TLPhotoPicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'TLPhotoPicker'
s.version = '2.0.12'
s.version = '2.1.1'
s.summary = 'multiple phassets picker for iOS lib. like facebook'

# This description is used to generate tags and improve search results.
Expand Down
6 changes: 6 additions & 0 deletions TLPhotoPicker/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
21 changes: 21 additions & 0 deletions TLPhotoPicker/Assets.xcassets/arrow.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "arrow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions TLPhotoPicker/Assets.xcassets/camera.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions TLPhotoPicker/Assets.xcassets/pop_arrow.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "pop_arrow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions TLPhotoPicker/Assets.xcassets/video.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "video.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions TLPhotoPicker/Classes/TLBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
//
//

import Foundation
import UIKit

open class TLBundle {
open class func podBundleImage(named: String) -> UIImage? {
let podBundle = Bundle(for: TLBundle.self)
if let url = podBundle.url(forResource: "TLPhotoPickerController", withExtension: "bundle") {
let bundle = Bundle(url: url)
return UIImage(named: named, in: bundle, compatibleWith: nil)!
return UIImage(named: named, in: bundle, compatibleWith: nil)
}
return nil
}
Expand Down
12 changes: 6 additions & 6 deletions TLPhotoPicker/Classes/TLCollectionTableViewCell.xib
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" 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="14824"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<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="TLCollectionTableViewCell" id="9FY-S1-KKQ" customClass="TLCollectionTableViewCell" customModule="TLPhotoPicker" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="TLCollectionTableViewCell" id="9FY-S1-KKQ" customClass="TLCollectionTableViewCell" customModule="TLPhotoPicker">
<rect key="frame" x="0.0" y="0.0" width="375" height="75"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9FY-S1-KKQ" id="UUZ-nI-xH1">
Expand All @@ -24,16 +24,16 @@
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="7nv-2U-xMp">
<rect key="frame" x="75" y="19.5" width="235" height="36.5"/>
<rect key="frame" x="75" y="19.5" width="234" height="36.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Camera Roll" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ES8-Tq-6Wz">
<rect key="frame" x="0.0" y="0.0" width="235" height="17"/>
<rect key="frame" x="0.0" y="0.0" width="234" height="17"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="9999" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NuJ-3w-ZAP">
<rect key="frame" x="0.0" y="22" width="235" height="14.5"/>
<rect key="frame" x="0.0" y="22" width="234" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.43137254901960786" green="0.43137254901960786" blue="0.43137254901960786" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
Expand Down
12 changes: 5 additions & 7 deletions TLPhotoPicker/Classes/TLPhotoCollectionViewCell.xib
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" 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="17156" 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="12088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<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"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="TLPhotoCollectionViewCell" id="IF3-4e-v0j" customClass="TLPhotoCollectionViewCell" customModule="TLPhotoPicker" customModuleProvider="target">
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="TLPhotoCollectionViewCell" id="IF3-4e-v0j" customClass="TLPhotoCollectionViewCell" customModule="TLPhotoPicker">
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
Expand All @@ -33,7 +31,7 @@
<constraint firstAttribute="height" constant="25" id="XvY-Ee-EA2"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="apl-2Q-Hz7" customClass="TLPlayerView" customModule="TLPhotoPicker" customModuleProvider="target">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="apl-2Q-Hz7" customClass="TLPlayerView" customModule="TLPhotoPicker">
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
Expand Down
2 changes: 1 addition & 1 deletion TLPhotoPicker/Classes/TLPhotoLibrary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017년 wade.hawk. All rights reserved.
//

import Foundation
import UIKit
import Photos

protocol TLPhotoLibraryDelegate: class {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by wade.hawk on 21/01/2019.
//

import Foundation
import UIKit
import Photos

public protocol TLPhotopickerDataSourcesProtocol {
Expand Down
16 changes: 9 additions & 7 deletions TLPhotoPicker/Classes/TLPhotosPickerViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TLPhotosPickerViewController" customModule="TLPhotoPicker" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TLPhotosPickerViewController" customModule="TLPhotoPicker">
<connections>
<outlet property="albumPopView" destination="Jcn-hC-Umh" id="c3n-m9-wfd"/>
<outlet property="cancelButton" destination="sqJ-Z7-zxj" id="J6u-hz-ePK"/>
Expand Down Expand Up @@ -58,24 +58,24 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Ql8-7f-9Uk">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="174.5" height="44"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xuG-bc-Oq9">
<rect key="frame" x="79.5" y="0.0" width="41.5" height="19.5"/>
<rect key="frame" x="66.5" y="0.0" width="41.5" height="19.5"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="kgt-Cn-AXg">
<rect key="frame" x="78" y="19.5" width="44.5" height="24.5"/>
<rect key="frame" x="65" y="19.5" width="44.5" height="24.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="DON-iU-Cox">
<rect key="frame" x="0.0" y="5.5" width="29.5" height="13.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="b7w-7R-rco">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow.png" translatesAutoresizingMaskIntoConstraints="NO" id="b7w-7R-rco">
<rect key="frame" x="34.5" y="7.5" width="10" height="10"/>
<constraints>
<constraint firstAttribute="width" priority="999" constant="10" id="7bM-Da-Q8A"/>
Expand Down Expand Up @@ -148,7 +148,7 @@
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="AEv-G6-dRI">
<rect key="frame" x="177.5" y="323.5" width="20" height="20"/>
</activityIndicatorView>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jcn-hC-Umh" customClass="TLAlbumPopView" customModule="TLPhotoPicker" customModuleProvider="target">
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jcn-hC-Umh" customClass="TLAlbumPopView" customModule="TLPhotoPicker">
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GKD-We-AdT">
Expand All @@ -172,7 +172,7 @@
<constraint firstAttribute="bottom" secondItem="grw-Nk-Sxr" secondAttribute="bottom" id="sPK-1G-qLo"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5zn-je-qLx">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="pop_arrow.png" translatesAutoresizingMaskIntoConstraints="NO" id="5zn-je-qLx">
<rect key="frame" x="180.5" y="10" width="14" height="7"/>
<constraints>
<constraint firstAttribute="height" constant="7" id="eZN-nB-EHu"/>
Expand Down Expand Up @@ -225,6 +225,8 @@
</view>
</objects>
<resources>
<image name="arrow.png" width="18" height="18"/>
<image name="photo" catalog="system" width="128" height="93"/>
<image name="pop_arrow.png" width="41" height="20"/>
</resources>
</document>
25 changes: 25 additions & 0 deletions TLPhotoPicker/TLBundle+SPM.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// TLBundle+SPM.swift
//
//
// Created by wade.hawk on 2020/09/20.
//

import Foundation

import UIKit

open class TLBundle {
open class func podBundleImage(named: String) -> UIImage? {
return UIImage(named: named, in: .module, compatibleWith: nil)
}

class func bundle() -> Bundle {
let podBundle = Bundle.module
if let url = podBundle.url(forResource: "TLPhotoPicker", withExtension: "bundle") {
let bundle = Bundle(url: url)
return bundle ?? podBundle
}
return podBundle
}
}

0 comments on commit b6b7b9c

Please sign in to comment.