Post

Replies

Boosts

Views

Activity

Save UIImage with CATransform3D applied
I have a 3х3 Matrix which I need to apply to UIImage and save it in Documents folder. I successfully converted the 3x3 Matrix (represented as [[Double]]) to CATrasform3D and then I have broken my head with trying to figure out how to apply it to UIImage. The only property where I can I apply it is UIView(or UIImageView in case with working with UIImage) transform property. But it has nothing to do with UIImage itself. I can't save the UIImage from transformed the UIImageView with all the transformations. And all the CoreGraphic methods (like concatenate for CGContext) only work with affine transformations which not suits for me. Please give me a hint what direction I should look. Does Apple has native methods or I have to use 3rd party frameworks for this functionality?
1
0
756
Aug ’24
Getting String representation of Swift ReferenceWritableKeyPath is failed (returns pointer instead of type)
I have a Product class inherited from Realm Object: @objc class Product: Object { @Persisted(primaryKey: true) var id: String = "" @Persisted var externalId: String? @Persisted var name: String? } I try to write a universal method for objects update which takes dictionary with keyPaths and values and update object with this Realm method: func setValue(_ value: Any?, forKey key: String) This is a computed variable for getting String representation of KeyPath: fileprivate extension KeyPath { var asString: String { let wholeString = String(describing: self) let dropLeading = "\\" + String(describing: Root.self) + "." let keyPathString = "\(wholeString.dropFirst(dropLeading.count))" return keyPathString } } And it's perfectly works during debug mode, but when I build an app with Release scheme instead of "Product.name" it returns something like "\Product.<computed 0x000000010c51ed18 (Bool)> and the app crashed trying to set value for this keypath. If anyone has idea how to fix this, it would be really appreciated.
1
0
597
Sep ’23
Exception 'NSJSONReadingAssumeTopLevelDictionary and NSJSONReadingAllowFragments cannot be set at the same time'
After upgrading an Xcode to 13.0 version and recompiling my app with it on a device I started getting this exception: libc++abi: terminating with uncaught exception of type NSException dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspectionDYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSJSONReadingAssumeTopLevelDictionary and NSJSONReadingAllowFragments cannot be set at the same time' terminating with uncaught exception of type NSException It seems that the problem is with the new option topLevelDictionaryAssume added in JSONSerialization.ReadingOptions, available only for ios15. What I've tried: I've checked all places where I had .allowFragments and replaced it with topLevelDictionaryAssume. It didn't help. Any advice would be appreciated.
2
0
629
Sep ’21
Save UIImage with CATransform3D applied
I have a 3х3 Matrix which I need to apply to UIImage and save it in Documents folder. I successfully converted the 3x3 Matrix (represented as [[Double]]) to CATrasform3D and then I have broken my head with trying to figure out how to apply it to UIImage. The only property where I can I apply it is UIView(or UIImageView in case with working with UIImage) transform property. But it has nothing to do with UIImage itself. I can't save the UIImage from transformed the UIImageView with all the transformations. And all the CoreGraphic methods (like concatenate for CGContext) only work with affine transformations which not suits for me. Please give me a hint what direction I should look. Does Apple has native methods or I have to use 3rd party frameworks for this functionality?
Replies
1
Boosts
0
Views
756
Activity
Aug ’24
Getting String representation of Swift ReferenceWritableKeyPath is failed (returns pointer instead of type)
I have a Product class inherited from Realm Object: @objc class Product: Object { @Persisted(primaryKey: true) var id: String = "" @Persisted var externalId: String? @Persisted var name: String? } I try to write a universal method for objects update which takes dictionary with keyPaths and values and update object with this Realm method: func setValue(_ value: Any?, forKey key: String) This is a computed variable for getting String representation of KeyPath: fileprivate extension KeyPath { var asString: String { let wholeString = String(describing: self) let dropLeading = "\\" + String(describing: Root.self) + "." let keyPathString = "\(wholeString.dropFirst(dropLeading.count))" return keyPathString } } And it's perfectly works during debug mode, but when I build an app with Release scheme instead of "Product.name" it returns something like "\Product.<computed 0x000000010c51ed18 (Bool)> and the app crashed trying to set value for this keypath. If anyone has idea how to fix this, it would be really appreciated.
Replies
1
Boosts
0
Views
597
Activity
Sep ’23
Exception 'NSJSONReadingAssumeTopLevelDictionary and NSJSONReadingAllowFragments cannot be set at the same time'
After upgrading an Xcode to 13.0 version and recompiling my app with it on a device I started getting this exception: libc++abi: terminating with uncaught exception of type NSException dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspectionDYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSJSONReadingAssumeTopLevelDictionary and NSJSONReadingAllowFragments cannot be set at the same time' terminating with uncaught exception of type NSException It seems that the problem is with the new option topLevelDictionaryAssume added in JSONSerialization.ReadingOptions, available only for ios15. What I've tried: I've checked all places where I had .allowFragments and replaced it with topLevelDictionaryAssume. It didn't help. Any advice would be appreciated.
Replies
2
Boosts
0
Views
629
Activity
Sep ’21