Comments (6)
Hey! Thank you for raising this and for putting together a sample project. I'll take a look and try and fix it :)
from showtime.
Hey :) sorry for the delay. So I think the solution to this is to just annotate the ShowTime
type with @MainActor
to enforce that it and any of its properties etc can only be used in a @MainActor
isolated environment.
This would mean that any place it's being used needs to be annotated with @MainActor
as well; luckily UIApplicationDelegate already is annotated with @MainActor
but if you're using any ShowTime property in a SwiftUI view you'll probably need to annotate the view with @MainActor
explicitly, which is a bit annoying but is technically correct for async code.
from showtime.
Hi @KaneCheshire, thanks for looking into it! By annotating the ShowTime
type with @MainActor
what do you mean exactly? Because in my code I'm directly using its static variables so I can't do something like
@MainActor let showTime = ShowTime()
or similar, and both the App
and UIApplicationDelegate
in which I use it are already annotated with @MainActor
.
Do you mean I should create an extension for ShowTime
and annotate it?
Thank you!
from showtime.
@cderito oh sorry no I explained that badly. What I mean is, the ShowTime type itself needs to be updated in this repo to be annotated with @MainActor
for strict concurrency. So it's nothing you're doing wrong at all, the compiler is just expecting us to isolate the getters and setters of the properties for strict concurrency.
My main concern with doing this is that even people who don't have strict concurrency mode enabled yet will be forced to add @MainActor
to their SwiftUI views or anywhere they're accessing ShowTime
properties in places not yet isolated to @MainActor
🤔
from showtime.
Oh I see! I had a 1:1 with an Apple engineer about Swift Concurrency some time after opening this issue and I got to know that there's a @preconcurrency
attribute that can be used inline with import
declarations to silence warnings but I couldn't get it to silence this particular warning, it seems it's dedicated to Sendable
related warnings.
Anyway this will probably become an error only once Swift 6 is out so I think the fix doesn't need to be immediate, it could just be planned in a roadmap to Swift 6, or rolled out at least once this flag becomes on by default in some Xcode release, what do you think about it?
from showtime.
@KaneCheshire Any plans on updating the lib with a fix for this?
Thanks for your effort on this lib.
from showtime.
Related Issues (20)
- Show taps in a SFSafariViewController HOT 4
- Swift Compiler Error: Type 'UIFontWeight' (aka 'CGFloat') has no member 'bold' HOT 7
- Option to automatically set fill colour to 50% alpha of stroke colour HOT 1
- Support Swift 4.2
- How to check whether user wear watch or not? HOT 1
- Support SPM HOT 4
- is it possible to get location touch data (coordinates)? HOT 2
- iOS 13.4 support HOT 2
- Support iPadOS pointers HOT 1
- Support showing hardware keyboard events
- Feature Request: Automatic mode
- 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.2 — please upgrade to at least 9.0 HOT 6
- Use GitHub Actions for running tests
- Release latest version to Cocoapods
- Where do I change the settings? HOT 5
- Disabled ShowTime should not slow down the app HOT 2
- Crash on iOS 16.1 HOT 4
- extension UIWindow and use swizzling HOT 1
- Yubikey5ci IOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from showtime.