Post

Replies

Boosts

Views

Activity

Calling from Watchos
I am working with a watchOS app in SwiftUI, and I am using the following code to dial a phone number from the watch: var number = "123456789" if let telURL = URL(string: "tel:\(number)") { let wkExtension = WKExtension.shared() wkExtension.openSystemURL(telURL) } The issue is that when I try to dial a number starting with a * (asterisk) or # (hash), it doesn't work. When dialing a regular number, it works fine. Is there any way to get this to work?
1
0
119
Apr ’25
torch level
why the setTorchModeOn not working? it not change the level torch     guard let device = AVCaptureDevice.default(for: .video) else { return }     if device.hasTorch {       do {         try device.lockForConfiguration()         try device.setTorchModeOn(level: 0.1)         if on == true {           device.torchMode = .on         } else {           device.torchMode = .off         }         device.unlockForConfiguration()       } catch {         print("Torch could not be used")       }     } else {       print("Torch is not available")     }   }
1
1
686
Nov ’22
recycling of list cells swiftui on scroll data
In my SwiftUI app, I have a data from an array. While scrolling through the list, the cells are being recycled, which is great. However, I'm puzzled because it seems that the data isn't being refetched as I scroll, which is contrary to what I expected. I want to understand why the data isn't being refetched for recycled cells and if this is expected behavior. class HistoryViewModel: ObservableObject { @Published var filteredContacts: [HistoryData] = [] func updateFilteredContacts() { filteredContacts = HistoryCallDataService().savedEntities if self.searchText.isEmpty { self.filteredContacts = filteredContacts } else { self.filteredContacts = filteredContacts.filter { contact in contact.firstName?.localizedCaseInsensitiveContains(self.searchText) ?? false || contact.lastName?.localizedCaseInsensitiveContains(self.searchText) ?? false || contact.telephone?.localizedCaseInsensitiveContains(self.searchText) ?? false } } } The List: List{ ForEach(vm.filteredContacts.reversed()) { item in HStack{ VStack(alignment: .leading){ Text("\(item.firstName ?? "N/A") \(item.lastName ?? "N/A" )") .fontWeight(.semibold) Text("\(item.telephone ?? "N/A")") .fontWeight(.medium) .padding(.top,1) } Spacer() VStack(alignment: .trailing){ Text("\(item.time ?? "N/A")") .fontWeight(.medium) Text("\(item.callHidden ? "Hidden" : "Normally ")") .foregroundColor(item.callHidden ? Color.theme.red : Color.theme.black) .fontWeight(.bold) .padding(.top,1) } } } } i attach image: https://im.ezgif.com/tmp/ezgif-1-db6ebe2a2e.gif [https://im.ezgif.com/tmp/ezgif-1-db6ebe2a2e.gif)
0
1
1k
Aug ’23
navigate to another view Swiftui
i have NavigationView in my code i do this for button it Navigation       Button{         print("")       }label: {         Image(systemName: "list.dash")           .foregroundColor(.gray)       }     } how i can navigate to another view when user click the button??
1
1
7.9k
Nov ’22