customize PHPicker's Navigationbar color in iOS15

I want to change the background color of PHPicker's navigationbar in iOS15.

↓This answer did not work in PHPicker

https://developer.apple.com/forums/thread/682420

How to customize?

Answered by Engineer in 706522022

PHPicker is out of process and currently doesn't support any UI customization, other than inheriting your application's tint color.

We recommend just using the default system picker UI. Most users already used PHPicker in other apps, and familiarity could help them trusting your app.

However, please submit an enhancement request via the Feedback app, if you think your app needs specific customization options.

I encounter the same problem. After a few days of research i found the following with which i was able to give the Navigationbar in the limited PHPicker my desired background color. But it didn´t fully work, because i have to click the Searchbar so that it accepts the color of the Navigationbar. In addition, the whole Navigationbar is still transparent even though i´ve set appearance.configureWithDefaultBackground(), which in my understanding is neither transparent nor translucent. When trying to set any color for the UIButton´s it won´t work as well.

I found it here: https://stackoverflow.com/questions/69796381/incorrect-navigation-bar-colour-in-limited-library-picker-on-ios-15

Some help here is really appreciated and for sake of completion i also used the methods of this thread: https://developer.apple.com/forums/thread/682420

Accepted Answer

PHPicker is out of process and currently doesn't support any UI customization, other than inheriting your application's tint color.

We recommend just using the default system picker UI. Most users already used PHPicker in other apps, and familiarity could help them trusting your app.

However, please submit an enhancement request via the Feedback app, if you think your app needs specific customization options.

I encountered the same problem. I applied the accentColor modifier of the view to change colour.

//SwiftuiView.swift

PhotoPicker(isPresented: $addImages)
                    .accentColor(.indigo)

//PhotoPicker.swift


struct PhotoPicker: UIViewControllerRepresentable {

    @Binding var isPresented: Bool    


  func makeUIViewController(context: Context) -> some UIViewController {

    var configuration = PHPickerConfiguration()

    configuration.filter = .images // filter only to images

    configuration.selectionLimit = 5 // ignore limit

    let photoPickerViewController = PHPickerViewController(configuration: configuration)

    photoPickerViewController.delegate = context.coordinator

    return photoPickerViewController

  }

  

  func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { }

  

  func makeCoordinator() -> Coordinator {

    Coordinator(self)

  }

  

  class Coordinator: PHPickerViewControllerDelegate {

    private let parent: PhotoPicker

    

    init(_ parent: PhotoPicker) {

      self.parent = parent

    }

    

    func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {

        parent.isPresented = false

    }

  }

}
customize PHPicker's Navigationbar color in iOS15
 
 
Q