Skip to content

Commit d668f11

Browse files
I changed the orientation notifier to be more "future proof."
1 parent 5e46820 commit d668f11

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# RVS_Spinner Change Log
22

3+
## 2.5.7
4+
5+
- **August 21, 2021**
6+
7+
- I rewrote the deprecated callback to be more "future-proof."
8+
39
## 2.5.6
410

511
- **August 15, 2021**

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,6 @@ The "**Highlight Colors**" Segmented Switch allows you to change the [`UIView.ti
330330

331331
![The HUD Mode Test App (Template SF Symbols Image)](img/HUD-Yellow-Question.png)
332332

333-
TODO
334-
=
335-
There is a deprecated callback: the orientation callback (observer) It is on [line 1655](https://github.com/RiftValleySoftware/RVS_Spinner/blob/main/Sources/RVS_Spinner/RVS_Spinner.swift#L1655). We need to address this, but it isn't a showstopper (yet).
336-
337333
LICENSE
338334
=
339335
MIT License

RVS_Spinner.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@
12671267
"$(inherited)",
12681268
"@executable_path/Frameworks",
12691269
);
1270-
MARKETING_VERSION = 2.5.6;
1270+
MARKETING_VERSION = 2.5.7;
12711271
PRODUCT_BUNDLE_IDENTIFIER = "com.riftvalleysoftware.RVS-Spinner-Basic-Test-Harness";
12721272
PRODUCT_NAME = "$(TARGET_NAME)";
12731273
SWIFT_VERSION = 5.0;
@@ -1288,7 +1288,7 @@
12881288
"$(inherited)",
12891289
"@executable_path/Frameworks",
12901290
);
1291-
MARKETING_VERSION = 2.5.6;
1291+
MARKETING_VERSION = 2.5.7;
12921292
PRODUCT_BUNDLE_IDENTIFIER = "com.riftvalleysoftware.RVS-Spinner-Basic-Test-Harness";
12931293
PRODUCT_NAME = "$(TARGET_NAME)";
12941294
SWIFT_VERSION = 5.0;
@@ -1475,7 +1475,7 @@
14751475
"$(inherited)",
14761476
"@executable_path/Frameworks",
14771477
);
1478-
MARKETING_VERSION = 2.5.6;
1478+
MARKETING_VERSION = 2.5.7;
14791479
PRODUCT_BUNDLE_IDENTIFIER = "com.riftvalleysoftware.RVS-Spinner-Tabbed-Test-Harness";
14801480
PRODUCT_NAME = "$(TARGET_NAME)";
14811481
SWIFT_VERSION = 5.0;
@@ -1496,7 +1496,7 @@
14961496
"$(inherited)",
14971497
"@executable_path/Frameworks",
14981498
);
1499-
MARKETING_VERSION = 2.5.6;
1499+
MARKETING_VERSION = 2.5.7;
15001500
PRODUCT_BUNDLE_IDENTIFIER = "com.riftvalleysoftware.RVS-Spinner-Tabbed-Test-Harness";
15011501
PRODUCT_NAME = "$(TARGET_NAME)";
15021502
SWIFT_VERSION = 5.0;
@@ -1519,7 +1519,7 @@
15191519
"$(inherited)",
15201520
"@executable_path/Frameworks",
15211521
);
1522-
MARKETING_VERSION = 2.5.6;
1522+
MARKETING_VERSION = 2.5.7;
15231523
PRODUCT_BUNDLE_IDENTIFIER = com.riftvalleysoftware.Spinner;
15241524
PRODUCT_NAME = "$(TARGET_NAME)";
15251525
SWIFT_VERSION = 5.0;
@@ -1542,7 +1542,7 @@
15421542
"$(inherited)",
15431543
"@executable_path/Frameworks",
15441544
);
1545-
MARKETING_VERSION = 2.5.6;
1545+
MARKETING_VERSION = 2.5.7;
15461546
PRODUCT_BUNDLE_IDENTIFIER = com.riftvalleysoftware.Spinner;
15471547
PRODUCT_NAME = "$(TARGET_NAME)";
15481548
SWIFT_VERSION = 5.0;
@@ -1563,7 +1563,7 @@
15631563
"$(inherited)",
15641564
"@executable_path/Frameworks",
15651565
);
1566-
MARKETING_VERSION = 2.5.6;
1566+
MARKETING_VERSION = 2.5.7;
15671567
PRODUCT_BUNDLE_IDENTIFIER = "com.riftvalleysoftware.RVS-Spinner-Leak-Test";
15681568
PRODUCT_NAME = "$(TARGET_NAME)";
15691569
SWIFT_VERSION = 5.0;
@@ -1584,7 +1584,7 @@
15841584
"$(inherited)",
15851585
"@executable_path/Frameworks",
15861586
);
1587-
MARKETING_VERSION = 2.5.6;
1587+
MARKETING_VERSION = 2.5.7;
15881588
PRODUCT_BUNDLE_IDENTIFIER = "com.riftvalleysoftware.RVS-Spinner-Leak-Test";
15891589
PRODUCT_NAME = "$(TARGET_NAME)";
15901590
SWIFT_VERSION = 5.0;

Sources/RVS_Spinner/RVS_Spinner.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
The Great Rift Valley Software Company: https://riftvalleysoftware.com
2222

23-
- version: 2.5.6
23+
- version: 2.5.7
2424
*/
2525

2626
import AudioToolbox
@@ -408,6 +408,8 @@ open class RVS_Spinner: UIControl, UIPickerViewDelegate, UIPickerViewDataSource
408408
/* ################################################################################################################################## */
409409
// MARK: - Private Instance Properties
410410
/* ################################################################################################################################## */
411+
private var _registeredOrientationObserver: Bool = false
412+
411413
/* ################################################################## */
412414
/**
413415
This is the display view for the center image.
@@ -1830,6 +1832,12 @@ open class RVS_Spinner: UIControl, UIPickerViewDelegate, UIPickerViewDataSource
18301832

18311833
super.layoutSubviews()
18321834
_correctRadius() // Make sure we stay in our lane.
1835+
1836+
// This ensures that the layout is recalculated, when the orientation changes.
1837+
if !_registeredOrientationObserver {
1838+
_registeredOrientationObserver = true
1839+
NotificationCenter.default.addObserver(self, selector: #selector(setNeedsLayout), name: UIDevice.orientationDidChangeNotification, object: nil)
1840+
}
18331841
}
18341842

18351843
/* ################################################################################################################################## */
@@ -1865,7 +1873,7 @@ open class RVS_Spinner: UIControl, UIPickerViewDelegate, UIPickerViewDataSource
18651873

18661874
/* ################################################################## */
18671875
/**
1868-
We cancel any decelerator display link from here, as well as our orientation notification.
1876+
We cancel any decelerator display link from here, and remove our listener.
18691877
*/
18701878
deinit {
18711879
NotificationCenter.default.removeObserver(self)

0 commit comments

Comments
 (0)