TODO

1.1.0

For when you know you're gonna get to something, but right now you have other priorities.
RougeWare/Swift-TODO

What's New

1.1.0 - Added a version that returns the appropriate contextual type

2020-11-05T00:28:53Z

This version adds a TODO function which returns the context's expected type (#5)

This is for when you use it in a place where Never is inappropriate, but you still aren't done writing an implementation, like this:

func magic() -> String {
    return TODO()
}

Before this version, the above code sample wouldn't compile, complaining that:

Cannot convert return expression of type 'Never' to return type 'String'

Now, it compiles just fine, and crashes as expected

Swift TODO()

For when you know you're gonna get to something, but right now you have other priorities. This lets incomplete code compile, so you can get to what really matters at this moment.

Example

import UIKit



public class MyViewController: UIViewController {
    
    public var value: Int
    
    
    init(initialValue: Int) {
        self.value = initialValue
        super.init(nibName: nil, bundle: nil)
    }
    
    
    init(coder: NSCoder) {
        TODO("Eventually this should be codable")
    }
}

Description

  • Swift Tools 5.1.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Oct 20 2024 16:11:17 GMT-0900 (Hawaii-Aleutian Daylight Time)