File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
_Testing_CoreGraphics/Attachments
_Testing_WinSDK/Attachments Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -46,18 +46,20 @@ extension AttachableImageFormat {
4646 /// @Available(Swift, introduced: 6.3)
4747 /// }
4848 public init ( contentType: UTType , encodingQuality: Float = 1.0 ) {
49+ let kind : Kind
4950 switch contentType {
5051 case . png:
51- self . init ( kind: . png, encodingQuality : encodingQuality )
52+ kind = . png
5253 case . jpeg:
53- self . init ( kind: . jpeg, encodingQuality : encodingQuality )
54+ kind = . jpeg
5455 default :
5556 precondition (
5657 contentType. conforms ( to: . image) ,
5758 " An image cannot be attached as an instance of type ' \( contentType. identifier) '. Use a type that conforms to 'public.image' instead. "
5859 )
59- self . init ( kind: . systemValue( contentType) , encodingQuality : encodingQuality )
60+ kind = . systemValue( contentType)
6061 }
62+ self . init ( kind: kind, encodingQuality: encodingQuality)
6163 }
6264
6365 /// Construct an instance of this type with the given path extension and
Original file line number Diff line number Diff line change @@ -224,14 +224,15 @@ extension AttachableImageFormat {
224224 @_spi ( _)
225225#endif
226226 public init ( encoderCLSID: CLSID , encodingQuality: Float = 1.0 ) {
227- switch CLSID . Wrapper ( encoderCLSID) {
227+ let kind : Kind = switch CLSID . Wrapper ( encoderCLSID) {
228228 case CLSID . Wrapper ( CLSID_WICPngEncoder) :
229- self = . png
229+ . png
230230 case CLSID . Wrapper ( CLSID_WICJpegEncoder) :
231- self = . jpeg
231+ . jpeg
232232 case let encoderCLSID:
233- self . init ( kind : . systemValue( encoderCLSID) , encodingQuality : encodingQuality )
233+ . systemValue( encoderCLSID)
234234 }
235+ self . init ( kind: kind, encodingQuality: encodingQuality)
235236 }
236237
237238 /// Construct an instance of this type with the given path extension and
You can’t perform that action at this time.
0 commit comments