This day covers the third and final part of Project 19: JavaScript Injection
in Hacking with Swift. Follow along at https://www.hackingwithswift.com/100/69.
I previously created projects alongside Hacking with Swift in a separate repository, and you can find Project 19 here. Even better, though, I copied it over to Day 67's folder so I could extend it for 100 Days of Swift.
With that in mind, Day 69 focuses on extending the project with a set of challenges.
Add a bar button item that lets users select from a handful of pre-written example scripts, shown using a
UIAlertController
– at the very least your list should include the example we used in this project.
- 🔗 Commit
You're already receiving the URL of the site the user is on, so use
UserDefaults
to save the user's JavaScript for each site. You should convert the URL to aURL
object in order to use its host property.
For something bigger, let users name their scripts, then select one to load using a
UITableView
.
- 🔗 I knocked these out together over a series of commits after Challenge 1.