Compile-time-checked URLs

Overview

SafeURL

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.

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding SafeURL as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/baguio/SwiftSafeURL")
],
targets: [
    .target(
        name: "<MyTargetName>",
        dependencies: ["SafeURL"],
        plugins: ["SafeURLPlugin"]
    ),
]

Example

// This will compile
let validUrl = URL(safeString: "https://example.tld")
// This won't
let invalidUrl = URL(safeString: "https://example./tld")

SafeURL requires its parameter to be a single simple string literal

If a file contains the comment // safeurl:warn, invalid URLs in this file will be compiled and will show a warning instead of an error. Note that this is not recommended, as this will still cause a force-stop on runtime.

You might also like...
Awesome-ML - Discover, download, compile & launch different image processing & style transfer CoreML models on iOS.
Awesome-ML - Discover, download, compile & launch different image processing & style transfer CoreML models on iOS.

⚠️ ⚠️ ⚠️ IMPORTANT: I'm no longer maintaining Awesome-ML. Awesome ML is an iOS app that is made to demonstrate different image processing CoreML model

Swift Package Manager plug-in to compile Metal files that can be debugged in Xcode Metal Debugger.

MetalCompilerPlugin Swift Package Manager plug-in to compile Metal files that can be debugged in Xcode Metal Debugger. Description Swift Package Manag

⛵️ URLNavigator provides an elegant way to navigate through view controllers by URLs.

URLNavigator ⛵️ URLNavigator provides an elegant way to navigate through view controllers by URLs. URL patterns can be mapped by using URLNavigator.re

A Swift client library for generating URLs with imgix

imgix-swift is a client library for generating image URLs with imgix. Written in Swift, but can be used with Objective-C codebases as well. Installati

DZURLRoute is an Objective-C implementation that supports standard-based URLs for local page jumps.

DZURLRoute Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements s.dependency 'DZVie

Makes building HTTP URLs and requests easy.

ModestProposal 2.0 Makes building HTTP URLs and requests easy. Can be used with any networking library that accepts NSURLRequest as a parameter. Featu

Uuid-shortener - UUID shortening to any base, for usage in urls

UUIDShortener Allow to shorten UUID, specially when using in URLs ; along with V

Link - a macos application for keeping important and complicated urls in one place
Link - a macos application for keeping important and complicated urls in one place

Link Description Link is a macos application for keeping important and complicat

A swift package(SPM) with iOS UI component that loads and displays images from remote urls or local assets and displays in a slide-show form with auto scroll feature.

MDBannersView A swift package with an iOS UI component that loads and displays images from remote urls, local assets and displays in a slide-show form

Swift package that uses WebKit to render PDF files from URLs

Swift package for generating a PDF file from a URL (rendered by WebKit)

A "time ago", "time since", "relative date", or "fuzzy date" category for NSDate and iOS, Objective-C, Cocoa Touch, iPhone, iPad

Migration 2014.04.12 NSDate+TimeAgo has merged with DateTools. DateTools is the parent project and Matthew York is the project head. This project is n

Stopwatch is a Swift App that measures amount of time elapsed from a particular time.
Stopwatch is a Swift App that measures amount of time elapsed from a particular time.

Stopwatch Stopwatch is a Swift App that measures amount of time elapsed from a particular time. It highly mocks the stopwatch of Apple's offical App c

A replacement for as which runs in constant time instead of O(n) when the conformance is not satisfiedA replacement for as which runs in constant time instead of O(n) when the conformance is not satisfied

ZConform A replacement for as? which runs in constant time instead of O(n) when the conformance is not satisfied. How it works ZConform does a one-tim

Sync your app's time with server's UTC time

ServerSync for iOS Apps Sometimes your app can't rely on the device's date and time settings being correct. This library will help you calibrate your

Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift

Real time Swift iOS Chat with Firebase - Messenger Clone This is an extremely simple chat app source code of an iOS Swift Chat app. It leverages Messa

Swifty Date & Time API inspired from Java 8 DateTime API.

AnyDate Swifty Date & Time API inspired from Java 8 DateTime API. Background I think that date & time API should be easy and accurate. Previous dates,

Time is a Swift package that makes dealing with calendar values a natural and straight-forward process.

Time Time is a Swift package that makes dealing with calendar values a natural and straight-forward process. Working with calendars can be extremely c

NVDate is an extension of NSDate class (Swift4), created to make date and time manipulation easier.

NVDate is an extension of NSDate class (Swift4), created to make date and time manipulation easier. NVDate is testable and robust, we wrote intensive test to make sure everything is safe.

SwiftDate 🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
SwiftDate 🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.

Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift. What's This? SwiftDate is the definitive toolchain to ma

Comments
  • Typos in source code

    Typos in source code

    https://github.com/baguio/SwiftSafeURL/blob/3656ad1146c6255e47d31ab7ddcc4595d29e30fe/Sources/SafeURLLintFramework/SafeURLLintFramework.swift#L8

    should be invalidSafeInputRegexes? ✌🏼

    Also: https://github.com/baguio/SwiftSafeURL/blob/3656ad1146c6255e47d31ab7ddcc4595d29e30fe/Sources/SafeURLLintFramework/SafeURLLintFramework.swift#L14 should ne disabledComment

    opened by Kaspik 5
  • Support for Swift 5.6

    Support for Swift 5.6

    Hi Jhonatan!

    I’d love to add both of these packages (SwiftSafeURL and XcodeIssueReporting) to the Swift Package Index. Unfortunately we currently don’t support Swift 5.7 packages as it’s still in beta. However, I checked by building them locally with 5.6 and I don’t think you’re using any 5.7 specific features?

    Would you consider these PRs to reduce the tools version?

    Thanks!

    opened by daveverwer 3
Owner
Jhonatan A.
Software Dev, mainly iOS apps
Jhonatan A.
A Swift client library for generating URLs with imgix

imgix-swift is a client library for generating image URLs with imgix. Written in Swift, but can be used with Objective-C codebases as well. Installati

imgix 24 Sep 28, 2022
AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, best suited for authenticating users over the internet.

AnylineFaceAuthentication AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, be

null 0 Mar 7, 2022
A free, multiplatform SDK for real-time facial motion capture using blendshapes, and rigid head pose in 3D space from any RGB camera, photo, or video.

mocap4face by Facemoji mocap4face by Facemoji is a free, multiplatform SDK for real-time facial motion capture based on Facial Action Coding System or

Facemoji 592 Jan 1, 2023
PublisherKit - An open source implementation of Apple's Combine framework for processing asynchronous events over time

Publisher Kit Overview PublisherKit provides a declarative Swift API for processing asynchronous events over time. It is an open source version of App

null 5 Feb 22, 2022
SQLite.swift provides compile-time confidence in SQL statement syntax and intent.

SQLite.swift A type-safe, Swift-language layer over SQLite3. SQLite.swift provides compile-time confidence in SQL statement syntax and intent. Feature

Stephen Celis 8.7k Jan 8, 2023
Demonstration code for a simple Swift property-wrapper, keypath-based dependency injection system. The keypaths ensure compile-time safety for all injectable services.

Injectable Demo Preliminary musings and demonstration code for a simple Swift property-wrapper, keypath-based dependency injection system. The keypath

Michael Long 12 Aug 5, 2022
Needle - Compile-time safe Swift dependency injection framework

Needle is a dependency injection (DI) system for Swift. Unlike other DI frameworks, such as Cleanse, Swinject, Needle encourages hierarchical DI struc

Uber Open Source 1.4k Jan 3, 2023
Toledo - a dependency injection library for Swift that statically generates resolvers at compile-time.

Toledo Toledo is a dependency injection library for Swift that statically generates resolvers at compile-time. Index Features Installation Usage Licen

Valentin Radu 18 Nov 25, 2022
This repository accompanies Test-Driven Development in Swift: Compile Better Code with XCTest and TDD

Apress Source Code This repository accompanies Test-Driven Development in Swift: Compile Better Code with XCTest and TDD by Gio Lodi (Apress, 2021). D

Apress 57 Jan 1, 2023
Discover, download, compile & launch different image processing & style transfer CoreML models on iOS.

⚠️ ⚠️ ⚠️ IMPORTANT: I'm no longer maintaining Awesome-ML. Awesome ML is an iOS app that is made to demonstrate different image processing CoreML model

eugene 171 Nov 8, 2022