Post

Replies

Boosts

Views

Activity

callkit and contact app
Hello, I am a developer currently working on a personal contact management app. What is the app? My app stores additional information beyond basic contact details. Therefore, instead of using the Contacts framework, I manage contact objects using Core Data. What am I trying to achieve? I want to display additional information on the caller ID screen when a call is received from a number stored in my app. What have I tried? I’ve attempted the following methods without success: 1. Call Directory Extension: I thought using this method would allow me to display additional information from Core Data on the call screen. However, I learned that when a call is received, the iOS system first searches for the phone number in the Contacts app and only looks to the Extension app if no match is found. Therefore, displaying contact information from my app seems unfeasible. 2. Custom Call UI: Using CallKit seemed like a viable option to display the necessary information during a call, but it appears to only be possible with VoIP apps. My app does not support VoIP calls, so this method was also not implementable. I am wondering if there are any technologies available that could help me achieve my goal, or if there’s something I might be missing. Any advice would be greatly appreciated. Thank you! If a similar question has been asked, I apologize for the repetition.
3
0
316
Oct ’24
SwiftUI List selection bug
Is there a way to optimize a List in SwiftUI? There is a problem with selection not working properly when the List has many rows. If you scroll to multi-select and up, some rows in the middle are not selected. I have an issue where selecting an unselected row deselects nearby rows. Is there any way for selection to work reliably even for a List of many rows? I would like to find a solution that is stable even when multiple lines are selected, like mail and note, which are the default apps in ios. ps. I am using CoreData. @State var selectedItem = Set<MyEntity>() List(selection: $selectItem){   ForEach(items, id: \.self){ item in     ContactsRow(contactsData: item)   } } .environment(\.editMode, $editMode)
1
0
1.6k
Jun ’22
Looking for hints on swiftui camera app.
hello. I am a beginner developer. I am creating a camera app using swiftui. I want to create an app that allows you to take pictures with a camera, apply filters, and save them. I'm practicing following Apple's sample tutorial. https://developer.apple.com/tutorials/sample-apps/capturingphotos-camerapreview It was possible to apply CIFilter to the image displayed in the viewfinder, but I don't know how to apply the filter to the saved photo. I'd like to get some hints on this.
1
0
579
Sep ’23
Help! Get a contact and store it in CoreData
overview of the problem I'm making an app with SwiftUI. We even implemented fetching contacts using CNContactStore. The goal is to get the contacts and store them separately in CoreData. This is because you need to assign and manage attributes that are not in the default contact. class ContactStore: ObservableObject {   @Environment(\.managedObjectContext) private var viewContext   @Published var error: Error? = nil   @Published var results: [CNContact] = []       func fetch() {     do {       let store = CNContactStore()       let keysToFetch = [CNContactGivenNameKey as CNKeyDescriptor,                 CNContactMiddleNameKey as CNKeyDescriptor,                 CNContactFamilyNameKey as CNKeyDescriptor,                 CNContactImageDataAvailableKey as CNKeyDescriptor,                 CNContactPhoneNumbersKey as CNKeyDescriptor,                 CNContactImageDataKey as CNKeyDescriptor]       os_log("Fetching contacts: now")       let containerId = store.defaultContainerIdentifier()       let predicate = CNContact.predicateForContactsInContainer(withIdentifier: containerId)       let contacts = try store.unifiedContacts(matching: predicate, keysToFetch: keysToFetch)       os_log("Fetching contacts: succesfull with count = %d", contacts.count)       self.results = contacts       print(results)     } catch let error {       print("error occured! : \(error.localizedDescription)")     }   } } problem Is there a way to store the contact information in the array 'results' as CoreData? The attributes set in CoreData are 'name', 'phone', and 'company'.
1
0
1k
Apr ’22
I found SwiftUI bug. List selection bug
I used List(select:) to make it selectable. When scrolling to select many rows, the selected content sometimes disappears. Is running out of memory a problem? While the default app in ios has smooth multi-selection, it is unstable when using swiftui's list function. Multi-select in the mail app, for example, doesn't run out of memory when many rows are selected. How do you achieve this perfection? The code is nothing special. Create a list with List(select:) and rows with ForEach(array, id:.self). I'll attach a video https://i.stack.imgur.com/2px9i.gif
1
0
566
Jun ’22
Help. (coredata, ForEach crash) I've been looking for an answer for 16 hours.
I am using coredata. Draw a rectangle by taking only 2 values ​​with ForEach. However, when I add new data or modify the data, the app crashes. ForEach must have a maximum index value of 1. This is because the limit of fetchrequest is 2. However, when I add new data, the value of index becomes 2 and get an 'out of range' error. I've been looking for an answer for 16 hours. import SwiftUI struct chart: View{   @Environment(\.managedObjectContext) private var viewContext   @FetchRequest var datas: FetchedResults<Mind>       @State var show = [true, false]       init() {     let request: NSFetchRequest<Success> = Mind.fetchRequest()           request.sortDescriptors = [       NSSortDescriptor(keyPath: \Success.date, ascending: false)     ]     request.fetchLimit = 2     _datas = FetchRequest(fetchRequest: request)   }       var body: some View{     VStack(alignment: .leading){       ForEach(0..<datas.map{$0.suc}.count, id: \.self){ index in         RoundedRectangle(cornerRadius: 5)           .fill(Color.objcolor.opacity(show[index] ? 1 : 0.7))           .frame(width: 10, height: 5)       }     }   } }
0
0
512
Nov ’21
anyone please help! (coredata, chart)
I want to plot the data stored in coredata as a chart. (using SwiftUI) The entity structure of the project is as follows. entity name: Item attribute : name(String), success(Int), date(Date) Among the above attributes, I want to draw the trend of the success attribute as a bar chart. I did find a suitable package for drawing charts. It is 'Charts' by appear. To draw a chart, you need to put success data in the data array, which is difficult. Either way it doesn't matter. Please suggest a specific way to draw a chart. For reference, I am attaching the code I used. import SwiftUI import SwiftUICharts import CoreData struct ChartView: View{     @Environment(\.managedObjectContext) private var viewContext     @FetchRequest var items: FetchedResults<Item>          var demoData: [Double] = []     @State var thinkData = []          init() {         let request: NSFetchRequest<Item> = Item.fetchRequest()                  request.sortDescriptors = [                 NSSortDescriptor(keyPath: \Item.date, ascending: true)             ]                           request.fetchLimit = 7         _items = FetchRequest(fetchRequest: request)                  for i in items{             demoData.append(Double(i.success))         }     }               var body: some View{         HStack{             Spacer()             BarChart()                 .data(aData)                 .chartStyle(ChartStyle(backgroundColor: .white,                                                foregroundColor: ColorGradient(.blue, .purple)))             Spacer()         }     } }
0
0
592
Oct ’21
CoreData and 'Charts'
I want to get data from coredata and present it as a chart. During the build process, it builds without any problem, but the chart is not visible when the actual app is run. I put some data in coredata. Why? import SwiftUI import SwiftUICharts import CoreData struct ChartView: View{     @Environment(\.managedObjectContext) private var viewContext     @FetchRequest var items: FetchedResults<Item>          @State var demoData: [Double] = []          init() {         let request: NSFetchRequest<Item> = Item.fetchRequest()                  request.sortDescriptors = [                 NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)             ]                           request.fetchLimit = 7         _items = FetchRequest(fetchRequest: request)                  for i in items{             demoData.append(i.think)         }     }          var body: some View{         BarChart()             .data(demoData)             .chartStyle(ChartStyle(backgroundColor: .white,                                            foregroundColor: ColorGradient(.blue, .purple)))     } }
3
0
1k
Oct ’21
help me! (coredata)
I am studying using core data. Especially the fetchrequest is difficult. Can't i save the last 7 values ​​of a specific attribute of coredata in an array? The goal is to use the charts package. I want to call 7 attribute values ​​and express them in a chart.
1
0
579
Oct ’21
help me! (data sync between watch and phone)
I'm making an Apple Watch app and an iPhone app. The structure of the app is as follows. (On Apple Watch) Count the number and store it in Userdefault.(title, number) (On Apple Watch) Press the 'Count Complete' button to send the title and number data to the iPhone app. (In the iPhone app) Save the data received from the Apple Watch as CoreData. Here's the problem. I don't know the proper way to transfer the data (title, number) generated by the Apple Watch to the iPhone.
9
0
5.3k
Sep ’21