Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 260464e

Browse files
author
Stephen Hawley
committed
Missed a couple types
1 parent 73e015d commit 260464e

File tree

2 files changed

+8
-94
lines changed

2 files changed

+8
-94
lines changed

SwiftRuntimeLibrary/SwiftAnyObject.cs

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,22 @@
66
using SwiftRuntimeLibrary.SwiftMarshal;
77

88
namespace SwiftRuntimeLibrary {
9-
public sealed class SwiftAnyObject : ISwiftObject {
9+
public sealed class SwiftAnyObject : SwiftNativeObject {
1010
SwiftAnyObject(IntPtr ptr)
11-
: this (ptr, SwiftObjectRegistry.Registry)
11+
: base (ptr, GetSwiftMetatype (), SwiftObjectRegistry.Registry)
1212
{
1313
}
1414

15-
SwiftAnyObject (IntPtr ptr, SwiftObjectRegistry registry)
16-
{
17-
SwiftObject = ptr;
18-
SwiftCore.Retain (ptr);
19-
registry.Add (this);
20-
}
21-
22-
#region IDisposable implementation
23-
24-
bool disposed = false;
25-
public void Dispose ()
26-
{
27-
Dispose (true);
28-
GC.SuppressFinalize (this);
29-
}
30-
3115
~SwiftAnyObject ()
3216
{
3317
Dispose (false);
3418
}
3519

36-
void Dispose (bool disposing)
37-
{
38-
if (!disposed) {
39-
if (disposing) {
40-
DisposeManagedResources ();
41-
}
42-
DisposeUnmanagedResources ();
43-
disposed = true;
44-
}
45-
}
46-
47-
void DisposeManagedResources ()
48-
{
49-
}
50-
51-
void DisposeUnmanagedResources ()
52-
{
53-
SwiftCore.Release (SwiftObject);
54-
}
55-
#endregion
56-
57-
#region ISwiftObject implementation
58-
59-
public IntPtr SwiftObject { get; set; }
60-
6120
public static SwiftAnyObject XamarinFactory (IntPtr p)
6221
{
63-
return new SwiftAnyObject (p, SwiftObjectRegistry.Registry);
22+
return new SwiftAnyObject (p);
6423
}
6524

66-
#endregion
67-
6825
public static SwiftAnyObject FromISwiftObject(ISwiftObject obj)
6926
{
7027
if (obj == null)

SwiftRuntimeLibrary/SwiftIteratorProtocol.cs

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct SwiftIteratorProtocolVtable {
3030
}
3131

3232

33-
public class SwiftIteratorProtocolProxy<T> : ISwiftObject, IIteratorProtocol<T> {
33+
public class SwiftIteratorProtocolProxy<T> : SwiftNativeObject, IIteratorProtocol<T> {
3434
static SwiftIteratorProtocolProxy ()
3535
{
3636
SetVTable ();
@@ -52,72 +52,29 @@ static void NextFuncReceiver (IntPtr returnVal, IntPtr self)
5252

5353
IIteratorProtocol<T> proxiedType;
5454

55+
5556
public SwiftIteratorProtocolProxy (IIteratorProtocol<T> proxiedType)
57+
: base (IteratorProtocolPinvokes.NewIteratorProtocol (StructMarshal.Marshaler.Metatypeof (typeof (T))),
58+
GetSwiftMetatype (), SwiftObjectRegistry.Registry)
5659
{
5760
this.proxiedType = proxiedType;
58-
SwiftObject = IteratorProtocolPinvokes.NewIteratorProtocol (StructMarshal.Marshaler.Metatypeof (typeof (T)));
59-
SwiftCore.Retain (SwiftObject);
60-
SwiftObjectRegistry.Registry.Add (this);
61-
}
62-
63-
SwiftIteratorProtocolProxy (IntPtr ptr)
64-
: this (ptr, SwiftObjectRegistry.Registry)
65-
{
6661
}
6762

6863
SwiftIteratorProtocolProxy (IntPtr ptr, SwiftObjectRegistry registry)
64+
: base (ptr, GetSwiftMetatype (), registry)
6965
{
70-
SwiftObject = ptr;
71-
SwiftCore.Retain (ptr);
72-
registry.Add (this);
73-
}
74-
75-
#region IDisposable implementation
76-
77-
bool disposed = false;
78-
public void Dispose ()
79-
{
80-
Dispose (true);
81-
GC.SuppressFinalize (this);
8266
}
8367

8468
~SwiftIteratorProtocolProxy ()
8569
{
8670
Dispose (false);
8771
}
8872

89-
void Dispose (bool disposing)
90-
{
91-
if (!disposed) {
92-
if (disposing) {
93-
DisposeManagedResources ();
94-
}
95-
DisposeUnmanagedResources ();
96-
disposed = true;
97-
}
98-
}
99-
100-
void DisposeManagedResources ()
101-
{
102-
}
103-
104-
void DisposeUnmanagedResources ()
105-
{
106-
SwiftCore.Release (SwiftObject);
107-
}
108-
#endregion
109-
110-
#region ISwiftObject implementation
111-
112-
public IntPtr SwiftObject { get; set; }
113-
11473
public static SwiftIteratorProtocolProxy<T> XamarinFactory (IntPtr p)
11574
{
11675
return new SwiftIteratorProtocolProxy<T> (p, SwiftObjectRegistry.Registry);
11776
}
11877

119-
#endregion
120-
12178
public static SwiftMetatype GetSwiftMetatype ()
12279
{
12380
return IteratorProtocolPinvokes.IteratorProtocolMetadataAccessor (SwiftMetadataRequest.Complete, StructMarshal.Marshaler.Metatypeof (typeof (T)));

0 commit comments

Comments
 (0)