Skip to content

Commit c4ef63e

Browse files
committed
Merge pull request #791 from nverinaud/reactiveview-ios-constructors
Update ReactiveNSView : add .ctor(CGRect) for Unified API.
2 parents 4ff011d + 14ecacb commit c4ef63e

9 files changed

+161
-96
lines changed

ReactiveUI/Cocoa/ReactiveCollectionReusableView.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
using System;
2-
using ReactiveUI;
3-
using System.Runtime.Serialization;
2+
using System.Collections.Generic;
43
using System.ComponentModel;
4+
using System.Diagnostics.Contracts;
5+
using System.Drawing;
6+
using System.Linq;
57
using System.Reactive;
6-
using System.Reflection;
7-
using System.Reactive.Subjects;
88
using System.Reactive.Concurrency;
9-
using System.Linq;
10-
using System.Threading;
119
using System.Reactive.Disposables;
12-
using System.Diagnostics.Contracts;
10+
using System.Reactive.Subjects;
11+
using System.Reflection;
1312
using System.Runtime.CompilerServices;
14-
using System.Collections.Generic;
15-
using System.Drawing;
13+
using System.Runtime.Serialization;
14+
using System.Threading;
15+
using ReactiveUI;
1616
using Splat;
1717

1818
#if UNIFIED
19+
using CoreGraphics;
1920
using Foundation;
2021
using UIKit;
2122
#else
@@ -28,8 +29,13 @@ namespace ReactiveUI
2829
public abstract class ReactiveCollectionReusableView : UICollectionReusableView,
2930
IReactiveNotifyPropertyChanged<ReactiveCollectionReusableView>, IHandleObservableErrors, IReactiveObject, ICanActivate
3031
{
31-
protected ReactiveCollectionReusableView() : base() { setupRxObj(); }
32+
#if UNIFIED
33+
protected ReactiveCollectionReusableView(CGRect frame) : base(frame) { setupRxObj(); }
34+
#else
3235
protected ReactiveCollectionReusableView(RectangleF frame) : base(frame) { setupRxObj(); }
36+
#endif
37+
38+
protected ReactiveCollectionReusableView() : base() { setupRxObj(); }
3339
protected ReactiveCollectionReusableView(IntPtr handle) : base(handle) { setupRxObj(); }
3440
protected ReactiveCollectionReusableView(NSObjectFlag t) : base(t) { setupRxObj(); }
3541
protected ReactiveCollectionReusableView(NSCoder coder) : base(coder) { setupRxObj(); }

ReactiveUI/Cocoa/ReactiveCollectionView.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
using System;
2-
using ReactiveUI;
3-
using System.Runtime.Serialization;
2+
using System.Collections.Generic;
43
using System.ComponentModel;
5-
using System.Reflection;
4+
using System.Diagnostics.Contracts;
5+
using System.Drawing;
6+
using System.Linq;
67
using System.Reactive;
7-
using System.Reactive.Subjects;
88
using System.Reactive.Concurrency;
9-
using System.Linq;
10-
using System.Threading;
119
using System.Reactive.Disposables;
12-
using System.Diagnostics.Contracts;
10+
using System.Reactive.Subjects;
11+
using System.Reflection;
1312
using System.Runtime.CompilerServices;
14-
using System.Collections.Generic;
15-
using System.Drawing;
13+
using System.Runtime.Serialization;
14+
using System.Threading;
15+
using ReactiveUI;
1616
using Splat;
1717

1818
#if UNIFIED
19+
using CoreGraphics;
1920
using Foundation;
2021
using UIKit;
2122
#else
@@ -28,7 +29,12 @@ namespace ReactiveUI
2829
public abstract class ReactiveCollectionView : UICollectionView,
2930
IReactiveNotifyPropertyChanged<ReactiveCollectionView>, IHandleObservableErrors, IReactiveObject, ICanActivate, ICanForceManualActivation
3031
{
32+
#if UNIFIED
33+
protected ReactiveCollectionView(CGRect frame, UICollectionViewLayout layout) : base(frame, layout) { setupRxObj(); }
34+
#else
3135
protected ReactiveCollectionView(RectangleF frame, UICollectionViewLayout layout) : base(frame, layout) { setupRxObj(); }
36+
#endif
37+
3238
protected ReactiveCollectionView(IntPtr handle) : base(handle) { setupRxObj(); }
3339
protected ReactiveCollectionView(NSObjectFlag t) : base(t) { setupRxObj(); }
3440
protected ReactiveCollectionView(NSCoder coder) : base(coder) { setupRxObj(); }

ReactiveUI/Cocoa/ReactiveCollectionViewCell.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
using System;
2-
using System.Drawing;
3-
using ReactiveUI;
4-
using System.Runtime.Serialization;
2+
using System.Collections.Generic;
53
using System.ComponentModel;
6-
using System.Reflection;
7-
using System.Reactive.Subjects;
8-
using System.Reactive.Concurrency;
9-
using System.Reactive;
4+
using System.Diagnostics.Contracts;
5+
using System.Drawing;
106
using System.Linq;
11-
using System.Threading;
7+
using System.Reactive;
8+
using System.Reactive.Concurrency;
129
using System.Reactive.Disposables;
13-
using System.Diagnostics.Contracts;
10+
using System.Reactive.Subjects;
11+
using System.Reflection;
1412
using System.Runtime.CompilerServices;
15-
using System.Collections.Generic;
13+
using System.Runtime.Serialization;
14+
using System.Threading;
15+
using ReactiveUI;
1616
using Splat;
1717

1818
#if UNIFIED
19+
using CoreGraphics;
1920
using Foundation;
2021
using UIKit;
2122
#else
@@ -27,11 +28,17 @@ namespace ReactiveUI
2728
{
2829
public abstract class ReactiveCollectionViewCell : UICollectionViewCell, IReactiveNotifyPropertyChanged<ReactiveCollectionViewCell>, IHandleObservableErrors, IReactiveObject, ICanActivate
2930
{
30-
public ReactiveCollectionViewCell(IntPtr handle) : base (handle) { setupRxObj(); }
31+
#if UNIFIED
32+
public ReactiveCollectionViewCell(CGRect frame) : base (frame) { setupRxObj(); }
33+
#else
34+
public ReactiveCollectionViewCell(RectangleF frame) : base (frame) { setupRxObj(); }
35+
#endif
36+
3137
public ReactiveCollectionViewCell(NSObjectFlag t) : base (t) { setupRxObj(); }
3238
public ReactiveCollectionViewCell(NSCoder coder) : base (NSObjectFlag.Empty) { setupRxObj(); }
3339
public ReactiveCollectionViewCell() : base() { setupRxObj(); }
34-
public ReactiveCollectionViewCell(RectangleF frame) : base (frame) { setupRxObj(); }
40+
41+
protected ReactiveCollectionViewCell(IntPtr handle) : base (handle) { setupRxObj(); }
3542

3643
public event PropertyChangingEventHandler PropertyChanging {
3744
add { PropertyChangingEventManager.AddHandler(this, value); }

ReactiveUI/Cocoa/ReactiveControl.cs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Reactive.Subjects;
77

88
#if UNIFIED
9+
using CoreGraphics;
910
using Foundation;
1011
using UIKit;
1112
#elif UIKIT
@@ -21,25 +22,16 @@ namespace ReactiveUI
2122
{
2223
public class ReactiveControl : UIControl, IReactiveNotifyPropertyChanged<ReactiveControl>, IHandleObservableErrors, IReactiveObject, ICanActivate, ICanForceManualActivation
2324
{
24-
protected ReactiveControl() : base()
25-
{
26-
}
27-
28-
protected ReactiveControl(NSCoder c) : base(c)
29-
{
30-
}
31-
32-
protected ReactiveControl(NSObjectFlag f) : base(f)
33-
{
34-
}
35-
36-
protected ReactiveControl(IntPtr handle) : base(handle)
37-
{
38-
}
25+
#if UNIFIED
26+
protected ReactiveControl(CGRect frame) : base(frame) { }
27+
#else
28+
protected ReactiveControl(RectangleF frame) : base(frame) { }
29+
#endif
3930

40-
protected ReactiveControl(RectangleF size) : base(size)
41-
{
42-
}
31+
protected ReactiveControl() { }
32+
protected ReactiveControl(NSCoder c) : base(c) { }
33+
protected ReactiveControl(NSObjectFlag f) : base(f) { }
34+
protected ReactiveControl(IntPtr handle) : base(handle) { }
4335

4436
public event PropertyChangingEventHandler PropertyChanging {
4537
add { PropertyChangingEventManager.AddHandler(this, value); }

ReactiveUI/Cocoa/ReactiveImageView.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
using System;
2-
using ReactiveUI;
3-
using System.Runtime.Serialization;
2+
using System.Collections.Generic;
43
using System.ComponentModel;
5-
using System.Reflection;
6-
using System.Reactive.Subjects;
7-
using System.Reactive.Concurrency;
4+
using System.Diagnostics.Contracts;
5+
using System.Drawing;
86
using System.Linq;
9-
using System.Threading;
7+
using System.Reactive;
8+
using System.Reactive.Concurrency;
109
using System.Reactive.Disposables;
11-
using System.Diagnostics.Contracts;
10+
using System.Reactive.Subjects;
11+
using System.Reflection;
1212
using System.Runtime.CompilerServices;
13-
using System.Collections.Generic;
14-
using System.Drawing;
13+
using System.Runtime.Serialization;
14+
using System.Threading;
15+
using ReactiveUI;
1516
using Splat;
16-
using System.Reactive;
1717

1818
#if UNIFIED
19+
using CoreGraphics;
1920
using Foundation;
2021
using UIKit;
21-
using NSImageView = UIKit.UIImageView;
2222
using NSImage = UIKit.UIImage;
23+
using NSImageView = UIKit.UIImageView;
2324
using NSView = UIKit.UIView;
2425
#elif UIKIT
2526
using MonoTouch.Foundation;
@@ -36,8 +37,12 @@ namespace ReactiveUI
3637
{
3738
public abstract class ReactiveImageView : NSImageView, IReactiveNotifyPropertyChanged<ReactiveImageView>, IHandleObservableErrors, IReactiveObject, ICanActivate, ICanForceManualActivation
3839
{
40+
#if UNIFIED
41+
public ReactiveImageView(CGRect frame) : base(frame) { }
42+
#else
3943
public ReactiveImageView(RectangleF frame) : base(frame) { }
40-
public ReactiveImageView(IntPtr handle) : base(handle) { }
44+
#endif
45+
4146
public ReactiveImageView() { }
4247

4348
#if UIKIT
@@ -47,6 +52,8 @@ public ReactiveImageView(NSImage image, NSImage highlightedImage) : base(image,
4752
public ReactiveImageView(NSCoder coder) : base(coder) { }
4853
#endif
4954

55+
protected ReactiveImageView(IntPtr handle) : base(handle) { }
56+
5057
public event PropertyChangingEventHandler PropertyChanging {
5158
add { PropertyChangingEventManager.AddHandler(this, value); }
5259
remove { PropertyChangingEventManager.RemoveHandler(this, value); }

ReactiveUI/Cocoa/ReactiveNSView.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
using System;
2-
using System.Drawing;
3-
using System.Runtime.Serialization;
4-
using System.Reactive.Subjects;
5-
using System.Reactive.Concurrency;
6-
using System.Reflection;
2+
using System.Collections.Generic;
73
using System.ComponentModel;
4+
using System.Diagnostics.Contracts;
5+
using System.Drawing;
86
using System.Linq;
9-
using System.Threading;
7+
using System.Reactive;
8+
using System.Reactive.Concurrency;
109
using System.Reactive.Disposables;
11-
using System.Diagnostics.Contracts;
10+
using System.Reactive.Subjects;
11+
using System.Reflection;
1212
using System.Runtime.CompilerServices;
13-
using System.Collections.Generic;
13+
using System.Runtime.Serialization;
14+
using System.Threading;
1415
using Splat;
15-
using System.Reactive;
1616

1717
#if UNIFIED
18-
using UIKit;
18+
using CoreGraphics;
1919
using Foundation;
2020
using NSView = UIKit.UIView;
21+
using UIKit;
2122
#elif UIKIT
22-
using MonoTouch.UIKit;
2323
using MonoTouch.Foundation;
24+
using MonoTouch.UIKit;
2425
using NSView = MonoTouch.UIKit.UIView;
2526
#else
2627
using MonoMac.AppKit;
@@ -51,9 +52,15 @@ protected ReactiveView(IntPtr handle) : base(handle)
5152
{
5253
}
5354

55+
#if UNIFIED
56+
protected ReactiveView(CGRect frame) : base(frame)
57+
{
58+
}
59+
#else
5460
protected ReactiveView(RectangleF size) : base(size)
5561
{
5662
}
63+
#endif
5764

5865
public event PropertyChangingEventHandler PropertyChanging {
5966
add { PropertyChangingEventManager.AddHandler(this, value); }

ReactiveUI/Cocoa/ReactiveTableView.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
using System;
2-
using ReactiveUI;
3-
using System.Runtime.Serialization;
2+
using System.Collections.Generic;
43
using System.ComponentModel;
5-
using System.Reflection;
6-
using System.Reactive.Subjects;
7-
using System.Reactive.Concurrency;
4+
using System.Diagnostics.Contracts;
5+
using System.Drawing;
86
using System.Linq;
9-
using System.Threading;
7+
using System.Reactive;
8+
using System.Reactive.Concurrency;
109
using System.Reactive.Disposables;
11-
using System.Diagnostics.Contracts;
10+
using System.Reactive.Subjects;
11+
using System.Reflection;
1212
using System.Runtime.CompilerServices;
13-
using System.Collections.Generic;
14-
using System.Drawing;
13+
using System.Runtime.Serialization;
14+
using System.Threading;
15+
using ReactiveUI;
1516
using Splat;
16-
using System.Reactive;
1717

1818
#if UNIFIED
19+
using CoreGraphics;
1920
using Foundation;
2021
using UIKit;
2122
#else
@@ -27,14 +28,20 @@ namespace ReactiveUI
2728
{
2829
public abstract class ReactiveTableView : UITableView, IReactiveNotifyPropertyChanged<ReactiveTableView>, IHandleObservableErrors, IReactiveObject, ICanActivate, ICanForceManualActivation
2930
{
31+
#if UNIFIED
32+
public ReactiveTableView(CGRect frame) : base(frame) { }
33+
public ReactiveTableView(CGRect frame, UITableViewStyle style) : base(frame, style) { }
34+
#else
3035
public ReactiveTableView(RectangleF frame) : base(frame) { }
31-
public ReactiveTableView(IntPtr handle) : base(handle) { }
3236
public ReactiveTableView(RectangleF frame, UITableViewStyle style) : base(frame, style) { }
37+
#endif
3338

3439
public ReactiveTableView(NSObjectFlag t) : base(t) { }
3540
public ReactiveTableView(NSCoder coder) : base(coder) { }
3641
public ReactiveTableView() { }
3742

43+
protected ReactiveTableView(IntPtr handle) : base(handle) { }
44+
3845
public event PropertyChangingEventHandler PropertyChanging {
3946
add { PropertyChangingEventManager.AddHandler(this, value); }
4047
remove { PropertyChangingEventManager.RemoveHandler(this, value); }

0 commit comments

Comments
 (0)