From Kavon F(Apple), during Ask Apple
So, this interaction with default protocol witnesses has been reported before here. If you want the ability to override the Parent class's default witness to the f() requirement that was provided by Prot, the Parent , who is the actual conformer of the protocol, currently must provide its own witness so that the subclass (e.g., Example3 ) can use a standard method override to change the Parent behavior after the fact. Protocols don't support inheritance, so they're choosing the methods directly listed in the type that wants to conform (or using defaults). Since a subclass can always be substitued in places where the superclass type is expected, the subclass is considered to be already conforming to the protocol. Thus, the conformance listed in the subclass is currently considered meaningless. It could mean that, and to make it happen, a pitch on Swift Evolution would be a way to start the conversation.
Post
Replies
Boosts
Views
Activity
You can set your developer name only when adding an app to your account the first time. It cannot be edited or updated later, so it is important to add it correctly.
Some say whatever developer name you set, sooner or later you lose, when updating your legal data, because then your developer name will be unified with your legal name. If you manage to verify it, please share it here. Good luck.
Example1().g() -> child's implementation
Example2().g() -> protocol extension's implementation
Example3().g() -> child's implementation again
Example3().g(), with func f() also in Parent -> (Error) missing 'override' keyword
Example3().g(), with func f() in Parent, and override func f() in child -> child's implementation
Example3().g(), with func f() in Parent, and func f() removed from a child -> parent's implementation
In this hypothetical example, when both Parent and Child explicitly declare conformance to a protocol, their behaviour is more consistent compared to when only Parent explicitly declare conformance.
Dictionary
is a collection whose elements are key-value pairs. And the declaration of a Collection is protocol Collection<Element> : Sequence
So the answer is in the definition: an element.
This question refers to AVFoundation, but similar question with reference to Core Midi is posted there.
With specified outputFormatSettings[AVFormatIDKey] = kAudioFileWAVEType instead of generating WAVE files, the code example crashes with
Error Domain=com.apple.coreaudio.avfaudio Code=1718449215 "(null)" UserInfo={failed call=err}
zsh: illegal hardware instruction ./SignalGenerator -duration 3 -output ./output.wav
where 1718449215 is the code for kAudioFormatUnsupportedDataFormatError.
Answering my own question with help from Nate M from Apple:
The values sequence just requests one value at a time, so if another value arrives before it has been requested, it gets dropped. This can be fixed by adding
a call to buffer - for example:
for await anyInt in subject.buffer(size: 1000, prefetch: .keepFull, whenFull: .dropOldest).values {
print(" LOOP \(anyInt)")
}
Use a sensible value for the size parameter; .max is usable as long as you're aware that this can lead to high memory usage.
The sink sequence, on the other hand, requests unlimited elements, so it calls
the closure with every value sent.