Skip to content
ํ”„๋กœ์ ํŠธ

์†Œ๊ฐœ

๐Ÿ“ท ์—ฌ๋Ÿฌ phassets๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋Š” iOS ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค. Facebook๊ณผ ๋น„์Šทํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

์›น ๋ฐ ์•ฑ ๊ฐœ๋ฐœ

์ด ์ˆ˜์น˜๋ฅผ ์ธก์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

What you can do

  • ๐Ÿ—‚๏ธ Smart albums โ€” Camera roll, selfies, panoramas, favorites, videos and user albums
  • โ–ถ๏ธ Playback โ€” Videos and Live Photos play right in the grid
  • ๐Ÿ“… Date navigation โ€” Open at a given day and scrub across months (2.2)
  • ๐Ÿ“ท Camera cell โ€” Built-in or fully custom live camera cell

์ธก์ •๋œ ์Šคํƒ€ ์ฆ๊ฐ€

in 24h
0
in 7 days
0
in 15 days
-2
in 1 month
-1

์„œ๋กœ ๊ฒน์น˜๋Š” ๊ธฐ๊ฐ„์˜ ์ˆœ์ฆ๊ฐ€๋Ÿ‰์ด๋ฉฐ ์ผ๋ณ„ ํ•ฉ๊ณ„๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์ธก์ •๊ฐ’์ด ์—†์œผ๋ฉด ๋น„์›Œ ๋‘ก๋‹ˆ๋‹ค. ์Šคํƒ€๋Š” ๊ด€์‹ฌ๋„๋ฅผ ๋‚˜ํƒ€๋‚ด๋ฉฐ ํ’ˆ์งˆ์„ ๋ณด์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

README.md

Original

TLPhotoPicker

A customizable photo & video picker for iOS โ€” smart albums, selection order, live playback and date navigation.

Swift Package Manager CocoaPods iOS 15+ Swift 5 MIT License Sponsor

Picker demo    Date scrubber demo

Contents

Why TLPhotoPicker

Apple's PHPickerViewController is the right choice when you only need to pick a few photos: it needs no Photos permission and runs out of process. Reach for TLPhotoPicker when the picker is part of your product UI:

TLPhotoPicker PHPickerViewController
Custom cells, colors and layout โœ… โ€”
Numbered selection order โœ… โœ… (iOS 15+)
Custom selection rules (canSelectAsset) โœ… โ€”
Camera cell inside the grid โœ… โ€”
Album switching โœ… โœ…
Open at a date, month scrubber โœ… โ€”
Live updates when the library changes โœ… โ€”
Works without Photos permission โ€” โœ…

Features

  • ๐Ÿ—‚๏ธ Smart albums โ€” Camera roll, selfies, panoramas, favorites, videos and user albums
  • ๐Ÿ”ข Selection order โ€” Numbered badges and max-selection limits
  • โ–ถ๏ธ Playback โ€” Videos and Live Photos play right in the grid
  • ๐Ÿ“… Date navigation โ€” Open at a given day and scrub across months (2.2)
  • ๐Ÿ“ท Camera cell โ€” Built-in or fully custom live camera cell
  • ๐ŸŽจ Customizable โ€” Custom cells, presets, builder-style configuration
  • ๐Ÿ”„ Live updates โ€” Reloads when the Photos library changes
  • โ˜๏ธ iCloud โ€” Downloads iCloud assets with progress
  • โšก Async/await โ€” fullResolutionImage() and file export helpers on TLPHAsset

Installation

Swift Package Manager (recommended)

In Xcode: File โ–ธ Add Package Dependenciesโ€ฆ and enter https://github.com/tilltue/TLPhotoPicker.git.

Or in Package.swift:

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

CocoaPods

pod 'TLPhotoPicker'

[!NOTE] The CocoaPods trunk becomes read-only on December 2, 2026. Existing versions keep resolving, but Swift Package Manager is the recommended way to stay up to date.

Privacy keys

Add these to your Info.plist:

<key>NSPhotoLibraryUsageDescription</key>
<string>Access to photos is required to select images</string>
<key>NSCameraUsageDescription</key>
<string>Camera access is required to take photos</string>

[!TIP] With limited photo access (iOS 14+), add PHPhotoLibraryPreventAutomaticLimitedAccessAlert = YES to stop the system prompt on every launch. The picker then shows its own button to manage the selection. Learn more

Quick Start

import TLPhotoPicker

final class ViewController: UIViewController, TLPhotosPickerViewControllerDelegate {
    func openPicker() {
        let picker = TLPhotosPickerViewController()
        picker.delegate = self
        picker.configure = TLPhotosPickerConfigure()
            .numberOfColumns(3)
            .maxSelection(10)
        present(picker, animated: true)
    }

    func dismissPhotoPicker(withTLPHAssets: [TLPHAsset]) {
        Task {
            let images = await withTaskGroup(of: UIImage?.self) { group in
                withTLPHAssets.forEach { asset in group.addTask { await asset.fullResolutionImage() } }
                return await group.reduce(into: [UIImage]()) { if let image = $1 { $0.append(image) } }
            }
            // use images
        }
    }
}

Presets cover the common cases and can be extended with the builder methods:

picker.configure = .singlePhoto      // one photo, no video
picker.configure = .videoOnly        // videos only
picker.configure = .compactGrid      // 4 columns
picker.configure = .videoOnly.numberOfColumns(4).selectedColor(.systemBlue)

SwiftUI

Wrap the picker with UIViewControllerRepresentable and present it with fullScreenCover or sheet. The picker dismisses its own presentation, so isPresented returns to false automatically.

import SwiftUI
import TLPhotoPicker

struct PhotoPicker: UIViewControllerRepresentable {
    var configure = TLPhotosPickerConfigure()
    var onPick: ([TLPHAsset]) -> Void

    func makeUIViewController(context: Context) -> TLPhotosPickerViewController {
        let picker = TLPhotosPickerViewController()
        picker.configure = configure
        picker.delegate = context.coordinator
        return picker
    }

    func updateUIViewController(_ picker: TLPhotosPickerViewController, context: Context) {}

    func makeCoordinator() -> Coordinator { Coordinator(onPick: onPick) }

    final class Coordinator: NSObject, TLPhotosPickerViewControllerDelegate {
        let onPick: ([TLPHAsset]) -> Void
        init(onPick: @escaping ([TLPHAsset]) -> Void) { self.onPick = onPick }

        func dismissPhotoPicker(withTLPHAssets: [TLPHAsset]) {
            onPick(withTLPHAssets)
        }
    }
}

struct ContentView: View {
    @State private var showPicker = false
    @State private var assets: [TLPHAsset] = []

    var body: some View {
        Button("Choose Photos") { showPicker = true }
            .fullScreenCover(isPresented: $showPicker) {
                PhotoPicker(configure: .singlePhoto) { assets = $0 }
                    .ignoresSafeArea()
            }
    }
}

[!IMPORTANT] Embedding the picker in SwiftUI requires 2.2.0 or later. Earlier versions also dismissed the screen underneath.

Date Navigation

Open the picker at a given day โ€” handy for diaries, journals and anything tied to a date โ€” and let people drag a scrubber on the trailing edge to jump across months.

Date scrubber
var scrubber = TLDateScrubberConfigure()
scrubber.snapToMonth = true      // land on the first photo of each month
scrubber.showsYearMarks = true   // year marks along the track while dragging

picker.configure = TLPhotosPickerConfigure()
    .initialScrollDate(entryDate)   // open at this day (nearest older photo if the day is empty)
    .dateScrubber(scrubber)         // nil, the default, hides it

// Or jump at any time
picker.scrollTo(date: someDate, animated: true)
  • Lookups are binary searches over the fetch result, so they stay fast on libraries with tens of thousands of photos.
  • The bubble uses your locale ("Mar 2025", "2025๋…„ 3์›”") and fires a selection haptic on every month change.
  • VoiceOver users get an adjustable control that moves one month per swipe.
  • Requires a creationDate sort (the default). It is disabled with groupByFetch.

See the Configuration Guide for every option.


Recipes

Custom selection rules
picker.canSelectAsset = { asset in
    asset.pixelWidth >= 300 && asset.pixelHeight >= 300
}
picker.didExceedMaximumNumberOfSelection = { picker in
    // show an alert
}
Video recording only
picker.configure = TLPhotosPickerConfigure()
    .mediaType(.video)
    .allowPhotograph(false)
    .allowVideoRecording(true)
Capture to a file URL instead of the Photo Library
picker.didCaptureMediaURL = { url in
    // The camera and the picker are already dismissed here; just present your next screen.
    presentingViewController.present(MyUploadViewController(fileURL: url), animated: true)
}

Captured media is returned as a temporary file instead of being saved to the Photo Library.

Custom cells and camera cell
Smart Albums Live Photo Video Photo Custom Cell
Smart Album LivePhoto Video Photo Custom
picker.configure = TLPhotosPickerConfigure()
    .photoCellNib(name: "CustomCell_Instagram", bundle: .main)
    .cameraCellNib(name: "CustomCameraCell", bundle: .main)
Live camera cell

See Advanced Usage for subclassing and custom data sources.

Delegate methods

All methods are optional.

protocol TLPhotosPickerViewControllerDelegate {
    func shouldDismissPhotoPicker(withTLPHAssets: [TLPHAsset]) -> Bool
    func dismissPhotoPicker(withTLPHAssets: [TLPHAsset])
    func dismissPhotoPicker(withPHAssets: [PHAsset])
    func photoPickerDidCancel()
    func dismissComplete()
    func canSelectAsset(phAsset: PHAsset) -> Bool
    func didExceedMaximumNumberOfSelection(picker: TLPhotosPickerViewController)
    func handleNoAlbumPermissions(picker: TLPhotosPickerViewController)
    func handleNoCameraPermissions(picker: TLPhotosPickerViewController)
}
Working with TLPHAsset
let image = await asset.fullResolutionImage()

asset.cloudImageDownload(progressBlock: { progress in }, completionBlock: { image in })

asset.tempCopyMediaFile(convertLivePhotosToJPG: true) { url, mimeType in }

asset.photoSize { bytes in }

See the API Reference.

Example App

cd Example && pod install && open TLPhotoPicker.xcworkspace

Run TLPhotoPicker-Example and try with Date Navigation. To fill a simulator with dated photos:

swift Scripts/seed-dated-photos.swift /tmp/tl-seed 24
xcrun simctl addmedia booted /tmp/tl-seed/*.jpg

Documentation

Requirements

TLPhotoPicker iOS Swift Xcode
2.2 15.0+ 5.5+ 14.0+
2.1 13.0+ 5.0+ 14.0+

Contributing

Issues and pull requests are welcome. Please search existing issues first, and run the package tests by opening Package.swift in Xcode and pressing โŒ˜U on an iOS Simulator.

Support

TLPhotoPicker is maintained in my free time. If it saves you time, consider sponsoring โ€” it goes into iOS compatibility updates, new features and docs. ๐Ÿ™

Author

wade.hawk โ€” [email protected] ยท Using TLPhotoPicker in your app? Let me know!

License

MIT. See LICENSE.

๊ด€๋ จ ํ”„๋กœ์ ํŠธ ์‚ดํŽด๋ณด๊ธฐ

๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘โ€ฆ