awkward / tatsi Goto Github PK
View Code? Open in Web Editor NEWA drop-in replacement for UIImagePickerController with the ability to select multiple images and/or videos
License: MIT License
A drop-in replacement for UIImagePickerController with the ability to select multiple images and/or videos
License: MIT License
I run the example project. Everything went well, however, it seems there's a memory leak every time I present the picker controller. Could you check it? I attached video recording of the Xcode Instrument.
Why sequence selection of selected image not working?
Also, let me know how to add the numbers for selection.
Thanks in Advance.
iOS 13 change the default modalPresentationStyle
. If you set it to .fullscreen
on TatsiPickerViewController
before presenting it, the thumbnails are too small, just 50x50px
If you set it to .pageSheet
it looks correct with 100x100 thumbnails
It looks like it is caused by AssetsGridViewController.traitCollectionDidChange
not being called with modalPresentationStyle =
.fullscreen`.
I did some research and found this
If you rely on size changes to build adaptive layouts, you should review your code for iOS 13. UIKit now predicts the initial traits for a view so you cannot assume traitCollectionDidChange will be called when a view is first added to the view hierarchy.
Adding updateCollectionViewLayout()
to AssetsGridViewController.viewDidLoad
seems to help, but I am not sure it is the best solution.
We can see a crash in our crash reports regarding Memory, happening in the AssetsGridViewController
and 100% on iOS 13.
We still need to look into it but I have the feeling that this is caused by loading the previews for the first time, filling up the memory.
Any ideas?
I have set the showCameraOption as true in the config. The camera option is there, but when I click a photo through, it does not get saved anywhere. Neither it is returned in the didPickAssets function. Is it a bug? Or am I missing something in the code?
Hi,
I've try to read property of PHAsset, but I haven't understand how I can get information about image selected.
How can get NSURL or UIImage?
How to keep last selected album or library
The new "Animated" smart album should be with the other smart albums on iOS 11. Not above "All photos"
[original (sensitive) content removed]
Apps with Tatsi crash when there is a large collection of videos. This is likely a memory issue
Add an icon to the README.md and improve existing screenshots.
With Xcode 11 supporting SPM also for iOS app the Swift Package Manager support would be quite useful.
I'm getting some crashes while using the library.
From the logs i see that users have it when displaying Tatsi (modally).
Seems to be present only on iOS 13.3 by now.
Variety of devices.
Multiple com.apple.root.user-interactive-qos
threads spawned, waiting to requestImage
on libsystem_kernel.dylib __ulock_wait + 8
.
Can't reproduce locally.
Crashed: com.apple.root.user-interactive-qos
0 libobjc.A.dylib 0x19f438fb0 objc_msgSend + 16
1 CoreFoundation 0x19f5f9970 -[__NSDictionaryM objectForKeyedSubscript:] + 184
2 PhotoLibraryServices 0x1aa1a4304 PLDataStoreForClassIDAndLibraryID + 476
3 PhotoLibraryServices 0x1aa67d464 +[PLManagedAsset(RM) enumerateImageRequestHintData:assetWidth:assetHeight:libraryID:startingOffset:block:] + 332
4 Photos 0x1aafb1e54 _presentResourcesFromHintsUntilStop + 376
5 Photos 0x1aafb35d0 PHChooserListContinueEnumerating + 68
6 Photos 0x1aaffbc00 -[PHImageResourceChooser presentNextQualifyingResource] + 1476
7 Photos 0x1aaea6028 -[PHImageRequest startRequest] + 2120
8 Photos 0x1aaebd41c -[PHMediaRequestContext _registerAndStartRequests:] + 1176
9 Photos 0x1aaebbf68 -[PHMediaRequestContext start] + 260
10 Photos 0x1ab04cb3c -[PHImageManager runRequestWithContext:] + 324
11 Photos 0x1ab048498 -[PHImageManager requestNewCGImageForAsset:targetSize:contentMode:options:resultHandler:] + 1132
12 Photos 0x1ab04c468 -[PHImageManager requestImageForAsset:targetSize:contentMode:options:resultHandler:] + 200
13 Tatsi 0x1037e34ac (Missing)
14 Tatsi 0x1037e3ef4 (Missing)
15 libswiftObjectiveC.dylib 0x1d536ed9c autoreleasepool<A>(invoking:) + 64
16 Tatsi 0x1037e314c (Missing)
17 Tatsi 0x1037ef968 (Missing)
18 libdispatch.dylib 0x19f3c8b7c _dispatch_call_block_and_release + 32
19 libdispatch.dylib 0x19f3c9fd8 _dispatch_client_callout + 20
20 libdispatch.dylib 0x19f3d8cfc _dispatch_root_queue_drain + 644
21 libdispatch.dylib 0x19f3d9384 _dispatch_worker_thread2 + 120
22 libsystem_pthread.dylib 0x19f42f690 _pthread_wqthread + 216
23 libsystem_pthread.dylib 0x19f4359e8 start_wqthread + 8
On the simulator and device,
config.supportedMediaTypes = [.image] or config.supportedMediaTypes = [.video]
The above configuartion doesn't show photos or videos.
But config.supportedMediaTypes = [.image, .video]
shows up both image and video as expected.
Edit:
Never mind.
Fixed it by changing to guard self.supportedMediaTypes.contains(.image) || self.supportedMediaTypes.contains(.video) && self.supportedMediaSubTypes == nil else { return nil }
in TatsiConfig.swift - line 112. Changed && to ||
It looks like those albums are not showing in the picker. It would be great to see iCloud shared albums as well.
Hi, I am doing the library integration via SPM to my project in SwiftUI, but I have a problem because the Done at the top of the Tatsi view is not called and I can't get the selected images.
The code for the integration via UIViewControllerRepresentable is as follows:
import SwiftUI
import UIKit
// 1. Add Import Tatsi and Import Photos to your Swift
import Tatsi
import Photos
struct TatsiViewController: UIViewControllerRepresentable {
@Binding var show: Bool
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func makeUIViewController(context: UIViewControllerRepresentableContext<TatsiViewController>) -> TatsiPickerViewController {
// 2. (Optional) Create an instance of TatsiConfig and configure the settings.
var config = TatsiConfig.default
config.showCameraOption = false
config.supportedMediaTypes = [.image]
config.firstView = .userLibrary
// 3. Create an instance of TatsiPickerViewController. TatsiPickerViewController(config:) allows you to use the config from the previous step
let pickerViewController = TatsiPickerViewController(config: config)
// 5. Set the pickerDelegate on TatsiPickerViewController
pickerViewController.delegate = context.coordinator
// 6. Present the TatsiPickerViewController
return pickerViewController
}
func updateUIViewController(_ uiViewController: TatsiPickerViewController, context: UIViewControllerRepresentableContext<TatsiViewController>) {
uiViewController.delegate = context.coordinator
}
// 4. Implement TatsiPickerViewControllerDelegate
final class Coordinator: NSObject, TatsiPickerViewControllerDelegate, UINavigationControllerDelegate {
var parent: TatsiViewController
init(_ parent: TatsiViewController) {
self.parent = parent
}
func pickerViewController(_ pickerViewController: TatsiPickerViewController, didPickAssets assets: [PHAsset]) {
print("Picked assets: \(assets)")
parent.show = false
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
parent.show = false
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
picker.dismiss(animated: true, completion: nil)
parent.show = false
}
}
}
What do I need to integrate in order to obtain the selected images? Thank you!
In the picker I o not see the user created albums.
Hi and thanks for the great picker.
Would it be possible to implement an option to pass array of PHAssetIDs, which should appear pre -selected once the picker is invoked?
When the user scrolls the list of albums the number of photos in them is not displayed immediately.
It would be great to have the counted number of photos temporarily cached, and when the user scrolls back and forth, the previously counted values would be retrieved from the cache immediately.
Do you plan to add handling of PHAuthorizationStatus.limited
https://developer.apple.com/documentation/photokit/phauthorizationstatus/limited
currently it is handled by this code branch -
Interesting library, I am thinking about replacing my current implementation but I found one issue (for me). When I set config.maxNumberOfSelections = 1
and tap on some photo, the delegate fires immediately
Tatsi/Tatsi/Views/Assets Grid/AssetsGridViewController.swift
Lines 420 to 422 in c31db89
This is a problem in my use case (I sometimes allow the user to pick just 1 and sometimes an unlimited number of items) so I need the behavior to be consistent.
What about adding something like TatsiConfig.finishImmediatelyWithMaximumOfOne = true
that I could be able to set to false
?
With the introduction of the new Photo Picker API see here in WWDC20 called PHPickerViewController, is this even necessary still?
You should add info about Carthage as a method of installation to the README, because you have a shared target so Carthage works, I tried it.
how can i set videoMaximumDuration using this library
as i need 1 minute video only from camera/photogallery
With the color configuration I can set a link color. This works fine, except in the checkmark when you select images in the album. This checkmark always uses the default link color.
This can be seen in AssetCollectionViewCell.swift on line 65
This is either forgotten or skipped because in the AssetCollectionViewCell you don't have access to the configuration.
When I select a photo from library through Tatsi, the photo will be low quality! How can I fix it?
Thanks for Answering
Drag finger to select multiple photos not supported.
Hi, I would love using the following library but the is a major issue when selecting a few images and then scrolling up and down the collection.
Some cells are being automatically selected.
I have a filling that setting the cell to selected = false in the prepare for reuse function will solve the issue.
This seems to be an iOS 13 bug but easy fix would be appreciated.
This image getting URL:
Assets [<PHAsset: 0x11dc12570> 2E25AD2C-51D8-4431-882F-AC8CA2E8F65B/L0/001 mediaType=1/0, sourceType=1, (3024x4032), creationDate=2019-04-08 10:04:57 +0000, location=0, hidden=0, favorite=0 ]
This image not getting URL: (app will crash for data nil)
Assets [<PHAsset: 0x11dc065f0> 420A3B33-A758-4EC3-9DC1-D72AC88B98C9/L0/001 mediaType=1/4, sourceType=1, (1242x2208), creationDate=2019-04-11 07:14:37 +0000, location=0, hidden=0, favorite=0 ]
what are the difference b/w the above two Assets, How to resolve this issue ?
Hi there,
1.1.6 seems to be the latest on Cocoapods, could we get an update made available for 1.1.7 please?
I tried adding the source files manually, and I'm stuck as to what I should do for the project to build at
guard let image = (info[UIImagePickerController.InfoKey.editedImage] as? UIImage) ?? (info[UIImagePickerController.InfoKey.originalImage] as? UIImage) else { return }
in the didFinishPickingMediaWithInfo delegate method in AssetsGridViewController
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.