Post

Replies

Boosts

Views

Activity

Reply to Closure containing a declaration cannot be used with result builder 'ViewBuilder
Do not nest Content_Preview nor WebView into ContentView. // //  ContentView.swift // import SwiftUI import WebKit import UIKit // ** DO NOT NEST ** struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } } struct ContentView: View {     let webView = WebView(request: URLRequest(url: URL(string: "https://www.apple.com")!))     var body: some View {         VStack {             webView             HStack {                 Button(action: {                     self.webView.goBack()                 }) {                     Image(systemName: "arrowshape.left")                         .font(.title)                         .foregroundColor(.blue)                         .padding()                 }                 Spacer()                 Button(action: {                     self.webView.goHome()                 }) {                     Image(systemName: "house.fill")                         .font(.title)                         .foregroundColor(.blue)                         .padding()                 }                 Spacer()                 Button(action: {                     self.webView.goForward()                 }) {                     Image(systemName: "arrowshape.right")                         .font(.title)                         .foregroundColor(.blue)                         .padding()                 }             }         }     } } // ** DO NOT NEST ** struct WebView: UIViewRepresentable {     let request: URLRequest     private var webView: WKWebView?     init (request: URLRequest) {         self.webView = WKWebView()         self.request = request     }     func makeUIView(context: Context) -> WKWebView {         return webView!     }     func updateUIView(_ uiView: WKWebView, context: Context) {         uiView.load(request)     }     func goBack() {         webView?.goBack()     }     func goForward() {         webView?.goForward()     }     func goHome() {         webView?.load(request)     } }
Feb ’23
Reply to UITableView reorder does not work when drag/drop continuously
Did you implement the following three table-view properties and protocol conformances? https://developer.apple.com/documentation/uikit/views_and_controls/table_views/supporting_drag_and_drop_in_table_views override func viewDidLoad() { super.viewDidLoad() tableView.dragInteractionEnabled = true tableView.dragDelegate = self tableView.dropDelegate = self navigationItem.rightBarButtonItem = editButtonItem }
Topic: UI Frameworks SubTopic: UIKit Tags:
Feb ’23
Reply to Catching SIGTERM in daemon
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/Introduction.html https://developer.apple.com/library/archive/technotes/tn2083/_index.html#//apple_ref/doc/uid/DTS10003794 Research unix daemons in terms of how they're designed and architected. https://netzmafia.ee.hm.edu/skripten/unix/linux-daemon-howto.html
Topic: App & System Services SubTopic: Core OS Tags:
Feb ’23
Reply to get signal strength is not working in ios 16
That's the beauty of private APIs. You use them at your own risk. Maybe switch to checking for the strength using this API instead WiFi: https://developer.apple.com/documentation/networkextension/nehotspotnetwork/1618923-signalstrength Permission is required for obvious reasons: https://developer.apple.com/documentation/networkextension/hotspot_helper
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’23
Reply to Closure containing a declaration cannot be used with result builder 'ViewBuilder
Do not nest Content_Preview nor WebView into ContentView. // //  ContentView.swift // import SwiftUI import WebKit import UIKit // ** DO NOT NEST ** struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } } struct ContentView: View {     let webView = WebView(request: URLRequest(url: URL(string: "https://www.apple.com")!))     var body: some View {         VStack {             webView             HStack {                 Button(action: {                     self.webView.goBack()                 }) {                     Image(systemName: "arrowshape.left")                         .font(.title)                         .foregroundColor(.blue)                         .padding()                 }                 Spacer()                 Button(action: {                     self.webView.goHome()                 }) {                     Image(systemName: "house.fill")                         .font(.title)                         .foregroundColor(.blue)                         .padding()                 }                 Spacer()                 Button(action: {                     self.webView.goForward()                 }) {                     Image(systemName: "arrowshape.right")                         .font(.title)                         .foregroundColor(.blue)                         .padding()                 }             }         }     } } // ** DO NOT NEST ** struct WebView: UIViewRepresentable {     let request: URLRequest     private var webView: WKWebView?     init (request: URLRequest) {         self.webView = WKWebView()         self.request = request     }     func makeUIView(context: Context) -> WKWebView {         return webView!     }     func updateUIView(_ uiView: WKWebView, context: Context) {         uiView.load(request)     }     func goBack() {         webView?.goBack()     }     func goForward() {         webView?.goForward()     }     func goHome() {         webView?.load(request)     } }
Replies
Boosts
Views
Activity
Feb ’23
Reply to iOS 16: SwiftUI - Crashed: EXC_BAD_ACCESS KERN_INVALID_ADDRESS
Just make sure the API being used meet the minimum iOS level. Set your deployment target to the latest iOS 16; if the crash continues, it is a pattern misuse. If it does not happen, continue to lower the target iOS release to 15.0 and run the project. If it doesn't crash, step down to iOS 14 and run the project until the crash occurs.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to Crash on updateValue for Dictionary
cache[uid] = model
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to How to get IP address of interface a packet will sent on on iOS
These BSD APIs were neutered years ago by apple for privacy reasons to avoid using an IP or mac address tracking a user as a replacement to the once available unique device identifier. You will have to find the IP address by some other means maybe having the server detect the incoming IP address.
Replies
Boosts
Views
Activity
Feb ’23
Reply to SwiftUI: reference types leaks memory when used in State property wrapper.
No need for the 2nd init of simple in on Appear, so yes, it will leak memory as each instance is eventually taken care of by ARC.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to ps3 buttons not working in most programs OSX Big Sur 11.6.5
Welcome to the Apple Developer ForumsPost your questions, exchange knowledge, and connect with fellow developers and Apple engineers on a variety of software development topics. For questions about using Apple hardware and services, visit Apple Support Communities or the respective manufacturer support forums for non-Apple products and services.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to UITableView reorder does not work when drag/drop continuously
Did you implement the following three table-view properties and protocol conformances? https://developer.apple.com/documentation/uikit/views_and_controls/table_views/supporting_drag_and_drop_in_table_views override func viewDidLoad() { super.viewDidLoad() tableView.dragInteractionEnabled = true tableView.dragDelegate = self tableView.dropDelegate = self navigationItem.rightBarButtonItem = editButtonItem }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to DeviceActivityCenter stops monitoring if another Screen Time app starts monitoring during the same schedule
Sounds like expected behaviour to me given the one-app-at-a-time rule of iOS.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to Rust warp::hyper::client and hyper_tls leads to "decoding error" on MacOS only
Not an Apple product. The maintainers of that project will have to resolve the issue in their time.
Replies
Boosts
Views
Activity
Feb ’23
Reply to Catching SIGTERM in daemon
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/Introduction.html https://developer.apple.com/library/archive/technotes/tn2083/_index.html#//apple_ref/doc/uid/DTS10003794 Research unix daemons in terms of how they're designed and architected. https://netzmafia.ee.hm.edu/skripten/unix/linux-daemon-howto.html
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to XCODE 14.2 CPP20 CLANG support
Read the Xcode release notes.
Replies
Boosts
Views
Activity
Feb ’23
Reply to If C static buffer exceed 249440 bytes, dispatch async get EXC_BAD_ACCESS code=2 on Intel simulator
Isn't returning before creating the buffer a code smell? int do_some_c_stuff(void) { log("Do some logging"); return 0; char buf[249441]; <-- how can we perform a return and still assume this line will be executed? }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to If C static buffer exceed 249440 bytes, dispatch async get EXC_BAD_ACCESS code=2 on Intel simulator
See here: https://www.researchgate.net/post/What-is-the-maximum-size-of-an-array-in-C
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to get signal strength is not working in ios 16
That's the beauty of private APIs. You use them at your own risk. Maybe switch to checking for the strength using this API instead WiFi: https://developer.apple.com/documentation/networkextension/nehotspotnetwork/1618923-signalstrength Permission is required for obvious reasons: https://developer.apple.com/documentation/networkextension/hotspot_helper
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to Display UIStepper's `value` instead of `minimumValue at app's launch
Showing some code related to the issue will provide more insight.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Mar ’23