<commit_before>import Paparazzo
import UIKit

final class ViewController: UIViewController {
    
    private var photos = [MediaPickerItem]()
    
    private func updateUI() {
        imageView.setImage(fromSource: photos.first?.image)
    }
    
    // MARK: - Outlets and actions
    
    @IBOutlet private var imageView: UIImageView!

    @IBAction private func showMediaPicker() {
        
        let assemblyFactory = Paparazzo.AssemblyFactory(theme: PaparazzoUITheme.appSpecificTheme())
        let assembly = assemblyFactory.mediaPickerAssembly()
        
        let mediaPickerController = assembly.module(
            items: [],
            selectedItem: nil,
            maxItemsCount: 20,
            cropEnabled: true,
            cropCanvasSize: CGSize(width: 1280, height: 960),
            configuration: { [weak self] module in
                weak var module = module
                
                module?.setContinueButtonTitle("Done")
                
                module?.onFinish = { photos in
                    module?.dismissModule()
                    
                    // storing picked photos in instance var and updating UI
                    self?.photos = photos
                    self?.updateUI()
                }
                module?.onCancel = {
                    module?.dismissModule()
                }
            }
        )
        
        navigationController?.pushViewController(mediaPickerController, animated: true)
    }
    
    @IBAction private func showPhotoLibrary() {
        
        let assemblyFactory = Paparazzo.AssemblyFactory(theme: PaparazzoUITheme.appSpecificTheme())
        let assembly = assemblyFactory.photoLibraryAssembly()
        
        let galleryController = assembly.module(
            selectedItems: [],
            maxSelectedItemsCount: 5,
            configuration: { module in
                weak var module = module
                module?.onFinish = { result in
                    module?.dismissModule()
                }
            }
        )
        
        let navigationController = UINavigationController(rootViewController: galleryController)
        
        present(navigationController, animated: true, completion: nil)
    }
}<commit_msg>Modify storyboard example so that it displays first picked photo in image view<commit_after>import ImageSource
import Paparazzo
import UIKit

final class ViewController: UIViewController {
    
    private var photos = [ImageSource]()
    
    private func updateUI() {
        imageView.setImage(fromSource: photos.first)
    }
    
    // MARK: - Outlets and actions
    
    @IBOutlet private var imageView: UIImageView!

    @IBAction private func showMediaPicker() {
        
        let assemblyFactory = Paparazzo.AssemblyFactory(theme: PaparazzoUITheme.appSpecificTheme())
        let assembly = assemblyFactory.mediaPickerAssembly()
        
        let mediaPickerController = assembly.module(
            items: [],
            selectedItem: nil,
            maxItemsCount: 20,
            cropEnabled: true,
            cropCanvasSize: CGSize(width: 1280, height: 960),
            configuration: { [weak self] module in
                weak var module = module
                
                module?.setContinueButtonTitle("Done")
                
                module?.onFinish = { mediaPickerItems in
                    module?.dismissModule()
                    
                    // storing picked photos in instance var and updating UI
                    self?.photos = mediaPickerItems.map { $0.image }
                    self?.updateUI()
                }
                module?.onCancel = {
                    module?.dismissModule()
                }
            }
        )
        
        navigationController?.pushViewController(mediaPickerController, animated: true)
    }
    
    @IBAction private func showPhotoLibrary() {
        
        let assemblyFactory = Paparazzo.AssemblyFactory(theme: PaparazzoUITheme.appSpecificTheme())
        let assembly = assemblyFactory.photoLibraryAssembly()
        
        let galleryController = assembly.module(
            selectedItems: [],
            maxSelectedItemsCount: 5,
            configuration: { [weak self] module in
                weak var module = module
                module?.onFinish = { result in
                    module?.dismissModule()
                    
                    if case let .selectedItems(photoLibraryItems) = result {
                        self?.photos = photoLibraryItems.map { $0.image }
                        self?.updateUI()
                    }
                }
            }
        )
        
        let navigationController = UINavigationController(rootViewController: galleryController)
        
        present(navigationController, animated: true, completion: nil)
    }
}
{'fraction_non_alphanumeric': 0.07117948717948717, 'fraction_numerical': 0.0045128205128205125, 'mean_word_length': 1.6158798283261802, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2492503', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1073, 'n_words': 266}