{"id":36654,"date":"2022-08-03T17:50:04","date_gmt":"2022-08-03T21:50:04","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=36654"},"modified":"2022-08-03T17:50:04","modified_gmt":"2022-08-03T21:50:04","slug":"swiftsafeurl-compile-time-checked-urls","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2022\/08\/03\/swiftsafeurl-compile-time-checked-urls\/","title":{"rendered":"SwiftSafeURL: Compile-Time-Checked URLs"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/baguio\/SwiftSafeURL\">Jhonatan Avalos<\/a> (<a href=\"https:\/\/twitter.com\/mr___io\/status\/1550331968008716288\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/github.com\/baguio\/SwiftSafeURL\">\n<p>Tool for avoiding using the <code>URL(string:)<\/code> initializer with optional result, instead introducing a compile time URL validity check. Note, this does not check for website availability, but if the URL is formatted correctly.<\/p>\n<p>[&#8230;]<\/p>\n<p>If a file contains the comment <code>\/\/ safeurl:warn<\/code>, invalid <code>URL<\/code>s in this file will be compiled and will show a warning instead of an error.<\/p>\n<\/blockquote>\n<p>It&rsquo;s cool how straightforward it is these days to write little plug-ins that leverage and extend the compiler.<\/p>\n\n<p>See also: <a href=\"https:\/\/realm.io\/news\/appbuilders-jp-simard-sourcekit\/\">JP Simard<\/a>.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2022\/07\/08\/xcode-14-swift-package-plug-ins\/\">Xcode 14: Swift Package Plug-ins<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2017\/08\/23\/swift-local-refactoring\/\">Swift Local Refactoring<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Jhonatan Avalos (tweet): Tool for avoiding using the URL(string:) initializer with optional result, instead introducing a compile time URL validity check. Note, this does not check for website availability, but if the URL is formatted correctly. [&#8230;] If a file contains the comment \/\/ safeurl:warn, invalid URLs in this file will be compiled and will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2022-08-03T21:50:06Z","apple_news_api_id":"788102c2-7cf7-474d-9c02-afdbc3451004","apple_news_api_modified_at":"2022-08-03T21:50:06Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AeIECwnz3R02cAq_bw0UQBA","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[255,75,30,2077,74,71,901,489,226],"class_list":["post-36654","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-compiler","tag-developertool","tag-mac","tag-macos-12","tag-opensource","tag-programming","tag-swift-programming-language","tag-url","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/36654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=36654"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/36654\/revisions"}],"predecessor-version":[{"id":36655,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/36654\/revisions\/36655"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=36654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=36654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=36654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}