Post

Replies

Boosts

Views

Activity

Reply to Protecting resources in the application bundle?
I only know two ways of doing this Hide the file Change the file name from myFile.json to .myFile.json Your file will be hidden from people. However, some people may see it 2. Do it in code Instead of creating a file, make a string. Turn this File.html <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is a Heading</h1> <p>This is a paragraph.</p> </body> </html> Into this ViewController.swift var htmlstring = """ <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is a Heading</h1> <p>This is a paragraph.</p> </body> </html> """ There is a way to see the code however, very few people know about it
Jul ’20
Reply to Question on using private API in WKWebView
There are two ways of using private API Using Objective-C In your application, create an Objective-C header file (Make sure you enable bridging header). In the Objective-C file, add this code @interface WKPreferences () @end Open this link https://github.com/WebKit/webkit/blob/master/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm In the link, you will find many private API's Chose an API you want to use then add it to your Objective-C For Example... @interface WKPreferences () (void)_setDeveloperExtrasEnabled:(BOOL)developerExtrasEnabled; @end Then you just do this MyWebView.configuration.preferences._setDeveloperExtrasEnabled(true) Before adding another private API, make sure you change this (void)_setTelephoneNumberDetectionIsEnabled:(BOOL)telephoneNumberDetectionIsEnabled { _preferences->setTelephoneNumberParsingEnabled(telephoneNumberDetectionIsEnabled); } To this (void)_setTelephoneNumberDetectionIsEnabled:(BOOL)telephoneNumberDetectionIsEnabled; 2. Using the set value Go to this link https://github.com/WebKit/webkit/blob/master/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm Chose a API that isn’t an Objective-C function For example... (BOOL)_telephoneNumberDetectionIsEnabled { return _preferences->telephoneNumberParsingEnabled(); } Find the title of the Objective-C bool Which is _telephoneNumberDetectionIsEnabled Remove the underscore then put it in the string below mainWebView.configuration.preferences.setValue(true, forKey: "telephoneNumberDetectionIsEnabled")
Aug ’20