Posts

Post not yet marked as solved
1 Replies
1.2k Views
This code crashes ("Unexpectedly found nil while unwrapping an Optional value") import Combine class Receiver { &#9;&#9;var value: Int! &#9;&#9;var cancellables = Set<AnyCancellable>([]) &#9;&#9;init(_ p: AnyPublisher<Int,Never>) { &#9;&#9;&#9;&#9;p.assign(to: \.value, on: self).store(in: &cancellables) &#9;&#9;} } let receiver = Receiver(Just(5).eraseToAnyPublisher()) It does not crash if I use p.sink { self.value = $0 }.store(in: &cancellables) instead of the assign, and it does not crash if I do not use an optional for the value-property. To me this looks like a bug in Swift's constructor code, but maybe I am overlooking something?
Posted
by kristofv.
Last updated
.
Post not yet marked as solved
0 Replies
515 Views
I have a UIViewControllerInteractiveTransitioning conforming class that animates the dismissing from the presented view controller (ViewControllerGreen) that prefers its status bar hidden to the presenting view controller (ViewControllerRed) that does not. The presentation is done with a modalPresentationStyle = .custom and modalPresentationCapturesStatusBarAppearance = true. The presenting view controller has a navigation controller and showing status bar. I would expect that after dismissing the presented view controller the status bar returns to the state it was in before presenting (i.e. status bar being shown), but this does not happen without an explicit call to setNeedsStatusBarAppearanceUpdate at the right time. Is there something wrong in my implementation of the InteractiveTransitioningControllerGreenToRed that triggers this? I created a code sample - https://github.com/ristkof/SO-interactivetransitioning/ that should compile and run on Xcode 12.4 targeting Simulator iOS 14.4. Thanks for any help.
Posted
by kristofv.
Last updated
.