Hello community,
I just encountered a pretty weird behavior when I subclass
`UINavigationController` without overriding any initializers.
Simple Code:
import UIKit
class MyViewController: UINavigationController {
let value: Int = {
print("member init")
return 3
}()
}
If you want to match [UInt8] specifically, just use the non-sugared definition:
extension RawBits where RawValue == Array {
}
If you want it to match any array, that’s more complicated. As far as I’ve been
able to work out, you have to wrap it in a protocol. Most of Array’s usefulness
comes fr
I have the following:
public protocol RawBits: CustomStringConvertible, Collection {
associatedtype RawValue
var rawValue: RawValue { get set }
}
extension RawBits where RawValue: FixedWidthInteger, RawValue:
UnsignedInteger {
[...fields and methods are defined here...]
}
Ok, thanks!
On Wed, Dec 13, 2017 at 10:20 PM, Andrew Trick wrote:
> Yes, withExtendedLifetime is a generic API that guarantees the lifetime of
> any non-trivial value. i.e. if the tuple contains a reference, the lifetime
> of that reference will be extended.
>
> That said, there is a theoretical
Yes, withExtendedLifetime is a generic API that guarantees the lifetime of any
non-trivial value. i.e. if the tuple contains a reference, the lifetime of that
reference will be extended.
That said, there is a theoretical bug in the optimizer that you will be much
more likely to hit in practice
Good question and good thought! I believe the answer is yes, this will work as
intended, but I'd like to get someone more versed in SIL than me to verify
that. Andy?
Jordan
> On Dec 13, 2017, at 01:28, Jens Persson via swift-users
> wrote:
>
> There are no restrictions on the type of the fi
There are no restrictions on the type of the first argument to
withExtendedLiftetime, even though it makes sense only for reference types.
So both the below variants will compile, and my question is if the first
one will work as expected (extending the lifetime of both a and b) or if
the second va