Enforce valid integer values at compile time in Swift
<p>In a Swift app I have a function that only accepts integers between +2 and positive infinity. Is there any way to enforce this at compile time?</p>

<p>Updated with a small code sample:</p>

<p>To calculate a Fibonacci sequence we need at least two numbers to start with, anything else is an error. Here I use guard and an failable initializer to verify this at runtime.</p>

<pre><code>struct FibonacciSeed {

    var magnitude = 2

    init() { }

    init?( magnitude: Int ) {

        guard magnitude &gt; 1 else { return nil }

        self.magnitude = magnitude

    }

    var seed: [Int] {

        // return valid seed ...

    }

}
</code></pre>

<p>I was curious if there were some fancy way to enlist the help of the compiler to enforce this at compile time. Like the compiler doesn't let me compile:</p>

<pre><code>var a:UInt = -8
</code></pre>