From a quick search through, I believe the change could be made here with a simple check for a prefix of “http://” and a suffix of “.onion”
You also need to deal with ATS. Need to set “NSAllowsArbitraryLoads” to true in the Info.plist
If this key is not set, iOS will reject any http connection attempts.
You can see Element for iOS have done it here