77
88namespace SwiftRuntimeLibrary {
99 public sealed class SwiftAnyObject : SwiftNativeObject {
10- SwiftAnyObject ( IntPtr ptr )
10+ SwiftAnyObject ( IntPtr ptr )
1111 : base ( ptr , GetSwiftMetatype ( ) , SwiftObjectRegistry . Registry )
1212 {
13+ SwiftCore . Retain ( ptr ) ;
1314 }
1415
1516 ~ SwiftAnyObject ( )
@@ -22,7 +23,7 @@ public static SwiftAnyObject XamarinFactory (IntPtr p)
2223 return new SwiftAnyObject ( p ) ;
2324 }
2425
25- public static SwiftAnyObject FromISwiftObject ( ISwiftObject obj )
26+ public static SwiftAnyObject FromISwiftObject ( ISwiftObject obj )
2627 {
2728 if ( obj == null )
2829 throw new ArgumentNullException ( nameof ( obj ) ) ;
@@ -37,7 +38,7 @@ public static SwiftMetatype GetSwiftMetatype ()
3738 public T CastAs < T > ( ) where T : class , ISwiftObject
3839 {
3940 var metaType = StructMarshal . Marshaler . Metatypeof ( typeof ( T ) ) ;
40- using ( var optional = SwiftOptional < T > . None ( ) ) {
41+ using ( var optional = SwiftOptional < T > . None ( ) ) {
4142 unsafe {
4243 fixed ( byte * dataPtr = StructMarshal . Marshaler . PrepareNominal ( optional ) ) {
4344 NativeMethodsForSwiftAnyObject . CastAs ( new IntPtr ( dataPtr ) , SwiftObject , metaType ) ;
@@ -51,8 +52,7 @@ public T CastAs<T> () where T : class, ISwiftObject
5152 }
5253
5354 internal static class NativeMethodsForSwiftAnyObject {
54- [ DllImport ( SwiftCore . kXamGlue , EntryPoint = XamGlueConstants . SwiftAnyObject_CastAs ) ]
55+ [ DllImport ( SwiftCore . kXamGlue , EntryPoint = XamGlueConstants . SwiftAnyObject_CastAs ) ]
5556 public static extern void CastAs ( IntPtr retval , IntPtr obj , SwiftMetatype meta ) ;
5657 }
57- }
58-
58+ }
0 commit comments