Post

Replies

Boosts

Views

Activity

PhotosPicker half size
I want to display a PhotosPicker in "half size " with the .presentationDetents([.medium, .large]) approach, but I cannot make it work. Here is a code example. If you run the example you will see that the bottom button opens a sheet in half screen. The top button will open the PhotosPicker, but not in "half size". Any help or info is greatly appreciated. import SwiftUI import PhotosUI struct ContentView: View {   @State private var showingGreeting = false   @State private var selectedItem: PhotosPickerItem? = nil   @State private var selectedImageData: Data? = nil   var body: some View {     VStack {       PhotosPicker(         selection: $selectedItem,         matching: .images,         photoLibrary: .shared()) {           Text("Open PhotosPicker")             .presentationDetents([.medium, .large])         }         .onChange(of: selectedItem) { newItem in           Task {             // Retrieve selected asset in the form of Data             if let data = try? await newItem?.loadTransferable(type: Data.self)             {               selectedImageData = data             }           }         }       if let selectedImageData,         let uiImage = UIImage(data: selectedImageData) {         Image(uiImage: uiImage)           .resizable()           .scaledToFit()           .frame(width: 250, height: 250)       }       Divider()       Button("Open sheet in half screen") {         showingGreeting.toggle()       }       .sheet(isPresented: $showingGreeting) {         Text("Hello there!")           .presentationDetents([.medium, .large])       }     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } }
1
0
1.2k
Aug ’22
XCode 15.8 beta 8 slow build incremental times
When I change something in any file XCode seem to build all files. This also afects preview in SwiftUI which is very slow. I have a few project with different config (one of them UIKit) and this issue seem to affect both.
Replies
0
Boosts
1
Views
420
Activity
Aug ’23
PhotosPicker half size
I want to display a PhotosPicker in "half size " with the .presentationDetents([.medium, .large]) approach, but I cannot make it work. Here is a code example. If you run the example you will see that the bottom button opens a sheet in half screen. The top button will open the PhotosPicker, but not in "half size". Any help or info is greatly appreciated. import SwiftUI import PhotosUI struct ContentView: View {   @State private var showingGreeting = false   @State private var selectedItem: PhotosPickerItem? = nil   @State private var selectedImageData: Data? = nil   var body: some View {     VStack {       PhotosPicker(         selection: $selectedItem,         matching: .images,         photoLibrary: .shared()) {           Text("Open PhotosPicker")             .presentationDetents([.medium, .large])         }         .onChange(of: selectedItem) { newItem in           Task {             // Retrieve selected asset in the form of Data             if let data = try? await newItem?.loadTransferable(type: Data.self)             {               selectedImageData = data             }           }         }       if let selectedImageData,         let uiImage = UIImage(data: selectedImageData) {         Image(uiImage: uiImage)           .resizable()           .scaledToFit()           .frame(width: 250, height: 250)       }       Divider()       Button("Open sheet in half screen") {         showingGreeting.toggle()       }       .sheet(isPresented: $showingGreeting) {         Text("Hello there!")           .presentationDetents([.medium, .large])       }     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } }
Replies
1
Boosts
0
Views
1.2k
Activity
Aug ’22
PhotosPicker presentationDetents
I am trying to present the PhotosPicker in "half size" with the .presentationDetents([.medium, .large]) approach, but I cant get it to work. Any working example would be greatly appreciated.
Replies
1
Boosts
0
Views
625
Activity
Aug ’22