Post

Replies

Boosts

Views

Activity

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
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
save image to gallery swiftui
it want to save QRCode to galley and i get the image but why it not save?? func saveImageQRCode(from string: String) {     filter.message = Data(string.utf8)     if let outputImage = filter.outputImage {       if context.createCGImage(outputImage, from: outputImage.extent) != nil { //        let ge = UIImage(cgImage: cgimg)         let transform = CGAffineTransform(scaleX: 10, y: 10)         let scaledCIImage = outputImage.transformed(by: transform)         let uiimage = UIImage(ciImage: scaledCIImage)                 let imageData = uiimage.pngData()!         let docDir = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)         let dataNow = "\(Date.now).png"         let imageURL = docDir.appendingPathComponent(dataNow)         try! imageData.write(to: imageURL)                   _ = UIImage(contentsOfFile: imageURL.path)!         UIImageWriteToSavedPhotosAlbum(uiimage, nil, nil, nil)       }     }   }
1
0
1.1k
Dec ’22
Issue with SwiftData in Sharing Data Across SwiftUI Project and Custom Keyboard Extension
I'm currently grappling with an issue while incorporating SwiftData into my SwiftUI project, specifically when dealing with a custom keyboard extension. The challenge lies in ensuring that the data I save and import through SwiftData is effectively shared between my main project and the custom keyboard extension. Despite my efforts, it seems like the data isn't being shared as intended. I've reviewed my SwiftData implementation and the interactions between the main project and the extension but haven't been able to pinpoint the root cause. var body: some Scene { WindowGroup { TabView{ ScreenOneView() .tabItem { Label("Main", systemImage: "square.and.pencil") } Text("Setting") .tabItem { Label("Setting", systemImage: "square.and.pencil") } } } .modelContainer(for: CopiedData.self) } } SwiftDataManager: class SwiftDataManager { static let shared = SwiftDataManager() func addItem(context: ModelContext, text: String){ let item = CopiedData(text: text) context.insert(item) } func deleteItem(context: ModelContext, item: CopiedData){ context.delete(item) } } View: struct ScreenOneView: View { @Environment(\.modelContext) private var context @Query private var items: [CopiedData] List{ ForEach(items) { item in HStack{ Text("\(item.text)") Spacer() buttons } } .onDelete(perform: { indexSet in for index in indexSet { vm.delete(context: context, deleteItem: items[index]) } }) } and the code from keyboard extension: class KeyboardViewController: UIInputViewController { override func viewDidLoad() { super.viewDidLoad() setupView() } func setupView(){ let keyboardView = UIHostingController(rootView: KeyboardView().modelContainer(for: CopiedData.self)) addChild(keyboardView) view.addSubview(keyboardView.view) keyboardView.view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ keyboardView.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), keyboardView.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), keyboardView.view.topAnchor.constraint(equalTo: view.topAnchor), keyboardView.view.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) keyboardView.didMove(toParent: self) } keyboardView: struct KeyboardView: View { @Environment(\.modelContext) private var context @Query private var items: [CopiedData] List{ ForEach(items) { item in contextTextCopied(text: "\(item.text)") .padding(.vertical, -6) } .onDelete(perform: { indexSet in }) .listRowBackground(Color.theme.background) } to add and delete data i use only single instance let swiftDataManager = SwiftDataManager.shared
1
0
813
Nov ’23
How to Update App Store Metadata via App Store Connect API Using Postman
I need help updating the description, keywords, what's new, and promotional text for my app on the App Store using the App Store Connect API through Postman. I already have my access token. I need to update the data for each language, I changed to PATCH, but what is the url to patch? And what json should I send?
1
0
824
Jul ’24
How to Prevent App Intents from Appearing in the Shortcuts App in SwiftUI Interactive Widgets
I'm working on a SwiftUI interactive widget using AppIntent. However, I want to prevent my AppIntents from appearing in the Shortcuts app. Currently, all my AppIntents are showing up in the Shortcuts app, but I only want them to be used within my widget. Is there a way to restrict the visibility of AppIntents so they don't appear in the Shortcuts app? Here is a simplified version of my AppIntent: import AppIntents struct MyWidgetIntent: AppIntent { static var title: LocalizedStringResource = "My Widget Intent" func perform() async throws -> some IntentResult { // Intent logic here } } I've looked into the documentation but haven't found a clear way to achieve this.
1
0
957
Aug ’24
Content Filter Permission Prompt Not Appearing in TestFlight
I added a Content Filter to my app, and when running it in Xcode (Debug/Release), I get the expected permission prompt: "Would like to filter network content (Allow / Don't Allow)". However, when I install the app via TestFlight, this prompt doesn’t appear at all, and the feature doesn’t work. Is there a special configuration required for TestFlight? Has anyone encountered this issue before? Thanks!
1
0
288
Jan ’25
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
117
Apr ’25
Do I need to declare data collection for simple GET requests
Hi, I have an iOS app that only makes GET requests to my own API (hosted on Cloudflare Workers). The app only receives information for its settings (like whether to show a coupon code). It does not send, collect, track, or share any user data, and I do not store or process any personal information. I understand that technical details (like IP address, user-agent, device information, etc.) are automatically sent as part of the internet protocol. Since I don’t log or use this data, I’m unsure if it counts as “data collection.” However, it is possible that Cloudflare collects this information for security purposes and deletes it after some time. Question: In this case, can I select “No data collected” in the App Privacy section of App Store Connect? Thanks!
1
0
134
Aug ’25
Swipe the table view swipe not disappear
why when i Swipe the table view the swipe not disappear? see screenshot It just gets stuck like that and won't come back, why?  func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {     let item = realArray[indexPath.row]     let callAction = UIContextualAction(style: .normal, title: "Call Private", handler: { (action, view, success) in       self.service.dialNumber(number: item.telephone, prefixNumber: true)       self.service.setupCallerId(firstName: item.firstName, lastName: item.lastName, telephone: item.telephone)     })     callAction.backgroundColor = .systemGreen     let configuration = UISwipeActionsConfiguration(actions: [callAction])     return configuration   }
0
0
474
Oct ’22
refresh list coredata swifui
i maked core data and i fetch all data to List. all working (add ,delete) but! if the app inactive (to background) and i open again to delete a row it crashes with error: "Thread 1: "An NSManagedObjectContext cannot delete objects in other contexts." struct HistoryView: View {   @State private var history: [HistoryList] = [HistoryList]()   let coreDM: CoreDataManager       var dateFormatter: DateFormatter {     let formatter = DateFormatter()     formatter.dateFormat = "MM-dd-yyyy HH:mm"     return formatter   }       private func populateHistory(){     history = coreDM.getAllHistory()   }       var body: some View {     NavigationView{       VStack {         if !history.isEmpty {           List {             ForEach(history, id: \.self) { historyList in               HStack {                 Text(dateFormatter.string(from: historyList.dateFlash ?? Date(timeIntervalSinceReferenceDate: 0)))                 Text("\(historyList.timerFlash)s")                   .multilineTextAlignment(.trailing)                   .frame(maxWidth: .infinity, alignment: .trailing)               }             }.onDelete(perform: { indexset in               indexset.forEach { index in                 let history = history[index]                 coreDM.deleteHistory(history: history)                 populateHistory()               }             })           }.refreshable {             populateHistory()             print("## Refresh History List")           }         } else {           Text("History Flashlight is Empty")         }       }       .onAppear {         populateHistory()         print("OnAppear")       }     }.navigationTitle("History Flashlight")       .navigationBarTitleDisplayMode(.inline)   } } struct HistoryView_Previews: PreviewProvider {   static var previews: some View {     HistoryView(coreDM: CoreDataManager())   } } why?
0
0
1.1k
Nov ’22
why the view is up when keyboard show?
i do this code: struct TextView: View {       @ObservedObject var service = Service()       @State private var text: String = ""   @FocusState var isInputActive: Bool   var body: some View {     ZStack{                     Color(red: 242 / 255, green: 242 / 255, blue: 247 / 255)         .edgesIgnoringSafeArea(.top)               VStack {         Text("QRCode Text")           .multilineTextAlignment(.center)           .font(.system(size: 30, weight: .heavy, design: .default))           .padding(.top, 16.0)                   TextField("Enter Text", text: $text)           .textFieldStyle(RoundedBorderTextFieldStyle())           .border(Color.white)           .fixedSize(horizontal: false, vertical: true)           .multilineTextAlignment(.center)           .padding()           .frame(width: 350, height: 80)           .background(Rectangle().fill(Color.white).shadow(radius: 20))           .cornerRadius(30)           .frame(height: 100)           .focused($isInputActive)           .toolbar {                     ToolbarItemGroup(placement: .keyboard) {                       Spacer()                       Button("Done") {                         isInputActive = false                       }                     }                   }         Image(uiImage: service.generateQRCode(from: "\(text)"))           .interpolation(.none)           .resizable()           .padding(2.0)           .scaledToFill()           .frame(width: 250, height: 250)                     .fixedSize(horizontal: false, vertical: true)           .multilineTextAlignment(.center)                     .frame(width: 350, height: 350)           .background(Rectangle().fill(Color.white).shadow(radius: 20))           .cornerRadius(30)         Button("Save QRCode") {           print("save")         }         .padding(.vertical, 10.0)         .padding(.horizontal, 100.0)         .background(Color.blue)         .cornerRadius(20)                 .foregroundColor(Color.white)         .frame(height: 100)                   Spacer()       }     }   } } and when i click on textfield and keyboard up, it up all view, why?
0
0
693
Dec ’22
Can i use Admob with my app and upload it to appstore?
I want to use Admob in my application - an ad when opening the application only! After many searches, some of which I did not find an answer but i found: As of December 8, 2020, Apple has made it mandatory for developers to release what data is being collected and what it's being used for. If developers don't comply, they won't be able to publish new apps or release updates for current apps. My questions is: According to Apple policies, can Admob be used in the application? and to upload the application, what data does Admob collect and what i need to mark in app store connect?
0
0
1.1k
Aug ’23