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