BLACK FRIDAY: Save 50% on my Swift books and videos! >>

< Previous: Fixing the keyboard: NotificationCenter   Next: Project 17 >

Wrap up

I'll tell you what: I'm feeling tired and I didn't even have to learn anything to write this project – I can't imagine how tired you are! But please don't be too disheartened: this project builds the the bridge between JavaScript and Swift, and now that bridge is built you can add your own Swift functionality on top.

Some of the code isn't pleasant to work with, and certainly I wish iOS would just figure out text view insets automatically for keyboards, but you're through it now so your project is done. Even though this was a hard project, I did cut quite a few corners in this project to make the code as easy as possible, so again I want to encourage you to try creating another extension and see how Apple's example code is different from mine.

If you'd like to make improvements to this project, you could try combining a number of techniques together to make a pretty awesome app.

You're already receiving the URL of the site the user is on, so why not use UserDefaults to save the user's JavaScript for each site? You should convert the URL to a URL object in order to use its host property.

If you wanted to be really fancy, you could let users name their scripts, then select one to load using a UITableView.

You did it! Now what?

You finished another project, and I'm glad Hacking with Swift helped you. Now I need your help. Please take just a moment out of your day to tell others about Hacking with Swift so they can benefit too.

You can click below to post a tweet straight to this project. Or if you're feeling particularly generous, you can click here to link to Hacking with Swift on your website and help spread the word.

Thank you. Your support is what keeps me going!

 

About the author

Paul Hudson is the creator of Hacking with Swift, the most comprehensive series of Swift books in the world. He's also the editor of Swift Developer News, the maintainer of the Swift Knowledge Base, and Mario Kart world champion. OK, so that last part isn't true. If you're curious you can learn more here.

Upgrade to the premium experience

Get all 40 projects in PDF and ePub, plus exclusive content that will take your Swift learning to the next level – buy the Hacking with Swift book today!

< Previous: Fixing the keyboard: NotificationCenter   Next: Project 17 >
MASTER SWIFT NOW
Buy Testing Swift Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let me know!

Click here to visit the Hacking with Swift store >>