Xcode isn’t avaiable for iPads, however, if you’re on Catalina or higher, you can use Sidecar. I haven’t tested it out but I think you can use Sidecar
Post
Replies
Boosts
Views
Activity
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
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")
Put this code in the webViewDidFinish
var request = URLRequest(url: URL(String: "Your URL Here")
request.cachePolicy = .(Something)
This will cache the url