So for my project it's a SwiftUI Project however if I Add '@objc' to expose this instance method to Objective-C it doesn't want it for some reason and the other error code is Argument of '#selector' refers to instance method 'refreshWebView' that is not exposed to Objective-C mainly this is the error I need to fix thanks in advance
this code is what's giving me the error
refreshControl.addTarget(self, action: #selector(refreshWebView(_:)), for: UIControl.Event.valueChanged)
this is for a pull to refresh the page
Post
Replies
Boosts
Views
Activity
So I have an app that is designed for local files a lot but if a user navigates to an area for photo taking it causes the app to crash. I don't really need camera access requirement for my app that's why I never bothered to add the request in it because I didn't feel like it was needed.
Currently my project I have works fine with if I load something small but if I load something big using WebKit it is very slow. I would like to have it work regardless of the load that is thrown at it as it would be the best user experience. Currently with testing seems like it is handling the rendering over a period of time vs all at once. Anyway I could have it load all at once vs like small little bits at a time. Like even increasing the disk and the memory temporarily while it loads. I wouldn't really typically expect an issue like this as I feel like iOS and devices should be very good processors in them to really handle anything a lot.
I don't know why but when I go into MusicKit part on developer part on my app on Apple's website there is no spot to configure it. I saw online a lot of articles saying that you have to configure it to use MusicKit with an app. Is this a bug or something or do I need to do something to enable it? I just don't understand I added it into my app but I can't seem to get this to work for some reason I'm not sure why.
Anyone know how Apple manages to make the UI colour the same as the Image or another object colour?
Like overall I think this is a really cool fun effect I'd love to play with this effect some somehow
Heres an example with how the New Safari does it with the page colour but I see it with other Apple apps like the music Player app for example.
Originally this was for a macOS app but I was wondering if it would be possible to make it work on iOS? I wanna make the app work for not only macOS but also work for iOS as for the future Apple plans to make iOS and macOS more together.
var body: some Scene {
WindowGroup {
ContentView(bm_observer: bm_observer, hs_observer: hs_observer).edgesIgnoringSafeArea(.top).frame(minWidth: 800, maxWidth: .infinity, minHeight: 120, maxHeight: .infinity).onAppear {
UIApplication.shared.windows.forEach({ $0.tabbingMode = .disallowed })
if let mainMenu = NSApp .mainMenu {
DispatchQueue.main.async {
if let edit = mainMenu.items.first(where: { $0.title == "Format"}) {
mainMenu.removeItem(edit);
}
}
}
}
}.windowStyle(HiddenTitleBarWindowStyle()).commands() {
CommandMenu("History") {
ForEach(hs_observer.history) { history in
Button(history.name) {
hs_observer.selected_history = history.url
let nc = NotificationCenter.default
nc.post(name: Notification.Name("selected_history"), object: nil)
}
} }
ContentView.swift
struct Webview : UIViewRepresentable {
@Binding var dynamicHeight: CGFloat
@Binding var offset: CGPoint
@Binding var selecting_tab: Bool
var webview: WKWebView = WKWebView()
var oldContentOffset = CGPoint.zero
var originalcenter = CGPoint.zero
class Coordinator: NSObject, WKNavigationDelegate {
var parent: Webview
init(_ parent: Webview) {
self.parent = parent
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
decisionHandler(WKNavigationActionPolicy(rawValue: WKNavigationActionPolicy.allow.rawValue + 2)!)
}
}
DispatchQueue.main.async { //omg
let window = UIApplication.shared.windows.first!
window.makeFirstResponder(nil)
}
extension UITextView { // << workaround !!!
open override var focusRingType: NSFocusRingType {
get { .none }
set { }
}
}
It says UIRefreshControl is not supported when running Catalyst apps in the Mac idiom. Consider using a Refresh menu item bound to ⌘-R what would I need to do to fix this to make my apps work with Catalyst?
This does not want to work at all with the new WK Web Kit but Will only work with the old UIWebKit I have tried a lot of new code but still doesn't wanna work at all.
do {
w.loadHTMLString(try NSString(contentsOfFile: Bundle.main.path(forResource: "index", ofType: "html")!, encoding: String.Encoding.utf8.rawValue) as String, baseURL: URL(fileURLWithPath: Bundle.main.bundlePath, isDirectory: true))
} catch {
// catch error
}