swift ios extension gives segmentation fault 11 with xcode10

Viewed 178

I am using swift 3.1, xcode 10 beta, cocapods 1.5.3

extension WithdrawFlow where Self: ViewcontrollerAnimatedTransition {
func navigate()
 ...
}

But compiler crashes at line where extension mostly due to use of "where Self: ViewcontrollerAnimatedTransition"

xcode 9 works fine. but xcode 10 is giving below:

  1. While emitting SIL for 'navigateInFlow(_:)' at Flow.swift:9:3
  2. While silgen emitFunction SIL function "@$S12module12FilePAASo41ViewcontrollerAnimatedTransitionRzrlE010navigateInE0yySSF". for 'navigate(_:)' at Flow.swift:9:3 error: Segmentation fault: 11

Can someone help ?

Thanks.

1 Answers

I had this issue and it was resolved by altering a function that contained an inout parameter with a default value. The function that told me the error was the first time in my application where it was called.

Old:

 /// Creates a new Icon button with the specified tint color, image and pulse animation
    convenience init(withTintColor tint: inout BehaviorRelay<UIColor> = UIColor.navBarTintColor,
                     tintedImage: UIImage?,
                     pulseAnimation: PulseAnimation = .centerRadialBeyondBounds
        ) {
        self.init(image: tintedImage?.withRenderingMode(.alwaysTemplate))
        self.pulseAnimation = pulseAnimation
        _ = (tint ?? UIColor.navBarTintColor).asObservable().subscribe(onNext: { [weak self] (newColor) in
            self?.tintColor = newColor
            self?.imageView?.tintColor = newColor
        })
    }

New:

 /// Creates a new Icon button with the specified tint color, image and pulse animation
    convenience init(tintedImage: UIImage?,
                     pulseAnimation: PulseAnimation = .centerRadialBeyondBounds
        ) {
        self.init(image: tintedImage?.withRenderingMode(.alwaysTemplate))
        self.pulseAnimation = pulseAnimation
        _ = UIColor.navBarTintColor.asObservable().subscribe(onNext: { [weak self] (newColor) in
            self?.tintColor = newColor
            self?.imageView?.tintColor = newColor
        })
    }
Related