Profile builds crash on continuousClock
dependency
#201
Replies: 11 comments
-
Hi @jaroslavas, I'm not sure the crash has anything to do with the continuous clock. I can comment out the clock in Core.swift, as well as all features using clocks, and it still doesn't seem to run in instruments. |
Beta Was this translation helpful? Give feedback.
-
That's weird. On my app, when I commented out the clock and all the code that uses it I was able to profile the app. |
Beta Was this translation helpful? Give feedback.
-
I've run into the same problem. Looks like it's a name demangling issue.
This points to Removing this dependency allowed it to run in Instruments. |
Beta Was this translation helpful? Give feedback.
-
Hi all, OK I have definitely been able to reproduce this, and definitely see that it is the Further, it seems related to existentials. The import Clocks
private enum AnyContinuousClockKey: DependencyKey {
static let liveValue = AnyClock(ContinuousClock())
}
extension DependencyValues {
var anyContinuousClock: AnyClock<Duration> {
get {
self[AnyContinuousClockKey.self]
}
}
}
@Dependency(\.anyContinuousClock) var clock This is a pretty big bummer. If we go in and change At the very least you can make use of this Incidentally we also stumbled upon yet another existential bug just this morning: swiftlang/swift#64974 😭 |
Beta Was this translation helpful? Give feedback.
-
I filed a feedback, and suggest anyone who has run into this issue also dupe it: https://gist.github.com/mbrandonw/8ea305e8b7ec169b3e04990e749a1236#file-fb12101499-md |
Beta Was this translation helpful? Give feedback.
-
That did the trick. I was attempting to profile with Instruments, as I've run into an issue where using a |
Beta Was this translation helpful? Give feedback.
-
The issue was caused by using |
Beta Was this translation helpful? Give feedback.
-
Wow, good find. I can reproduce that too. That is a serious bug in |
Beta Was this translation helpful? Give feedback.
-
Switched to using Now that I think about it, should binding changes cause re-renders? Seems like that should be limited to
Switching back, those same properties are listed as changing when using But, yes, this seems like a rather common use case. I'm reusing a filtering UI between features and didn't want it to send parent feature specific TCA actions. Here's another interesting one. I think the programatic push from the |
Beta Was this translation helpful? Give feedback.
-
It looks like the view's equatability may be contributing to this issue. Added some possible work arounds to apple/swift#64974. Unsure if useful. |
Beta Was this translation helpful? Give feedback.
-
I am going to convert this to a discussion as it's not a bug with the library but rather some confluence of Swift/SwiftUI/existentials. |
Beta Was this translation helpful? Give feedback.
-
Description
When profiling the app that depends on
continuousClock
, it crashes. Confirmed both on my pp and onCaseStudies (SwiftUI)
example app from swift-composable-architecture.Checklist
main
branch of this package.Expected behavior
It shouldn't crash :)
Actual behavior
App crashes.
Steps to reproduce
swift-composable-architecture
repoComposableArchitecture.xcworkspace
and selectCaseStudies (SwiftUI)
schemeProduct
->Profile
Leaks
Crash log points to
21 SwiftUICaseStudies 0x105ceaa06 Root.init() + 12 (00-Core.swift:63) [inlined]
.In my app, it also points to the line
Dependency(\.continuousClock) var clock
, so looks like there is a problem withcontinuousClock
dependency itself.Dependencies version information
0.2.0
Destination operating system
iOS 16
Xcode version information
14.2 (14C18)
Swift Compiler version information
No response
Beta Was this translation helpful? Give feedback.
All reactions