Post

Replies

Boosts

Views

Activity

Reply to Push notifcation-driven live activity not starting
Yeah well the live activity is not starting at all in the sense that nothing is ever received on my device and the live activity UI is not triggered despite it working locally which I verified through testing. before the log show the “unable to update live activity”, ill get logs showing the push token successfully going through aswell as my test payload. but Then after that these logs appear
Sep ’25
Reply to depreciated methods
@eskimo @Polyphonic UPDATE: here is my updated code that some of you were requesting. I have the updated methods implemented but im getting the error "Cannot convert return expression of type 'Double' to return type 'String?'" import Foundation class RAMUsage { let processInfo = ProcessInfo.processInfo func getRAM() { let physicalMemory = processInfo.physicalMemory let formatter = ByteCountFormatter() formatter.countStyle = .memory let formattedMemoryUsage = formatter.string(fromByteCount: Int64(physicalMemory)) parseAndPrint(formattedMemoryUsage: formattedMemoryUsage) } func parseAndPrint(formattedMemoryUsage: String) { print("Formatted RAM usage: \(formattedMemoryUsage)") if let gigsOfRAM = parseFormattedRAMUsage(formattedUsage: formattedMemoryUsage) { print("RAM Usage in Gigabytes: \(gigsOfRAM) GB") } else { print("Could not retrieve or parse RAM usage") } } func parseFormattedRAMUsage(formattedUsage: String) -> Double? { let scanner = Scanner(string: formattedUsage) var value: Double = 0.0 var unit: NSString? if let scannedValue = scanner.scanDouble(representation: .decimal) { value = scannedValue func scanCharacters(from set: CharacterSet) -> String? { if let unitString = unit as String?, unitString.lowercased() == "GB" { print("Parsed RAM Usage: \(value) GB") return value } else { print("could not parse and return value") } } return nil } } }
Topic: App & System Services SubTopic: General Tags:
Dec ’23
Reply to Push notifcation-driven live activity not starting
Yeah well the live activity is not starting at all in the sense that nothing is ever received on my device and the live activity UI is not triggered despite it working locally which I verified through testing. before the log show the “unable to update live activity”, ill get logs showing the push token successfully going through aswell as my test payload. but Then after that these logs appear
Replies
Boosts
Views
Activity
Sep ’25
Reply to refreshed/updated data on widgets
Thank you that is very helpful! Yeah I am using a lot of the default code that is included with WidgetKit and didn’t even bother to check that out. I’ll definitely get rid of the excess example widget default code aswell 👍
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to depreciated methods
@eskimo @Polyphonic UPDATE: here is my updated code that some of you were requesting. I have the updated methods implemented but im getting the error "Cannot convert return expression of type 'Double' to return type 'String?'" import Foundation class RAMUsage { let processInfo = ProcessInfo.processInfo func getRAM() { let physicalMemory = processInfo.physicalMemory let formatter = ByteCountFormatter() formatter.countStyle = .memory let formattedMemoryUsage = formatter.string(fromByteCount: Int64(physicalMemory)) parseAndPrint(formattedMemoryUsage: formattedMemoryUsage) } func parseAndPrint(formattedMemoryUsage: String) { print("Formatted RAM usage: \(formattedMemoryUsage)") if let gigsOfRAM = parseFormattedRAMUsage(formattedUsage: formattedMemoryUsage) { print("RAM Usage in Gigabytes: \(gigsOfRAM) GB") } else { print("Could not retrieve or parse RAM usage") } } func parseFormattedRAMUsage(formattedUsage: String) -> Double? { let scanner = Scanner(string: formattedUsage) var value: Double = 0.0 var unit: NSString? if let scannedValue = scanner.scanDouble(representation: .decimal) { value = scannedValue func scanCharacters(from set: CharacterSet) -> String? { if let unitString = unit as String?, unitString.lowercased() == "GB" { print("Parsed RAM Usage: \(value) GB") return value } else { print("could not parse and return value") } } return nil } } }
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Cannot find ContentVIew() in scope
The error doesn’t get generated in this file aka the ContentView.swift file but instead xcode brings up the default App.swift file(in my case its Mac_GPTApp.swift) and shows a “Cannot find ContentView() in scope” error for the line ContentView().
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’23