Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Essential 2nd Tutorial Longitude Latitude CLLocationCoordinate2D - Preview Crashed
You have updated landmarkData.json, to reference an image called "bkkbn". CircleImage_Previews is trying to display this image. Does the image named "bkkbn" exist in your project? More important than that... ...you are using a latitude of 106.880838, which is invalid. Latitude must be between -90 (South Pole) and 90 (North Pole) You may have got your longitude and latitude mixed up?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to Building apps in Xcode
If you are serious, and are prepared to put in some time, then have a look at the Stanford cs193 course. Paul Hegarty's depth of knowledge is outstanding, and he has the ability to explain things clearly. A good mix of theory and hands-on demo work.
Jan ’22
Reply to import pdf from url
It looks like a permissions issue. Try this: func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { guard let url = urls.first else { print("Error: no url") return } guard url.startAccessingSecurityScopedResource() else { print("Error: could not access content of url: \(url)") return } guard let dokument = PDFDocument(url: url) else { print("Error: could not create PDFDocument from url: \(url)") return } dokumnetpdf = dokument }
Jan ’22
Reply to import pdf from url
PDFDocument(url:) returns an Optional value... Try this: func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { guard let url = urls.first else {         print("Error: no url") return } guard let dokument = PDFDocument(url: url) else { print("Error: could not create PDFDocument from url: \(url)") return } dokumnetpdf = dokument }
Jan ’22
Reply to Pass a Timer through Controllers
I also wish for the user to be able to close the app and have the timer run in the background The timer will not run in the background, but here is a technique that you could use: Add a mechanism to detect when the app is entering the background, or foreground On backgrounding: If your timer is live... Convert it to a notification (calculate the fire date from the timer expiry) Cancel the timer If the timer expires while the app is backgrounded, the user will see the notification On foregrounding: Remove pending notifications Restart the timer, if it has not expired
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’22
Reply to iMac can’t recognize Logitech keyboard and mouse on login
Yes this seems to be a problem, where certain bluetooth devices are not recognized, before logging in. Which makes it difficult to login! I had a recent trauma with this, when booting in Recovery mode... I had to dig out an ancient wired mouse. I will be interested to see if anyone has a solution to this. iMac Pro MK Anywhere 2 mouse Wired keyboard (to get round this issue!)
Topic: App & System Services SubTopic: Hardware Tags:
Jan ’22
Reply to Can I use api `UIApplicationVolumeUpButtonDownNotification` for getting volume up/down button?
AVAudioSession has a property "outputVolume". You could look for changes to this, using Key-value observing... ...and use that to trigger your photo. That might go against rule 2.5.9, but since Apple's Camera app uses the volume buttons, I think it should be okay. (Note: this technique does not work in the Simulator, it needs a real device) Perhaps something like this: import AVFAudio class VolumeButtonObserver { let audioSession = AVAudioSession.sharedInstance() var outputVolumeObservation: NSKeyValueObservation? init() { observeVolumeButtons() } func observeVolumeButtons() { do { try audioSession.setActive(true) } catch {} outputVolumeObservation = audioSession.observe(\.outputVolume) { (audioSession, changes) in print("A volume button was pressed") /// Take action here... } } }
Jan ’22