Skip to content

Commit 4665994

Browse files
authored
Merge pull request #571 from TimOliver/xcode-15-support
Update project for Xcode 15 and iOS 17
2 parents 5b72b20 + b3e78d1 commit 4665994

34 files changed

+186
-118
lines changed

CropViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Pod::Spec.new do |s|
66
s.homepage = 'https://github.com/TimOliver/TOCropViewController'
77
s.author = 'Tim Oliver'
88
s.source = { :git => 'https://github.com/TimOliver/TOCropViewController.git', :tag => s.version }
9-
s.platform = :ios, '8.0'
9+
s.platform = :ios, '11.0'
1010
s.source_files = 'Swift/CropViewController/**/*.{h,swift}', 'Objective-C/TOCropViewController/**/*.{h,m}'
1111
s.exclude_files = 'Objective-C/TOCropViewController/include/**/*.h'
1212
s.resource_bundles = {

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2022 Tim Oliver
3+
Copyright (c) 2015-2024 Tim Oliver
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Objective-C/TOCropViewController/Categories/UIImage+CropRotate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// UIImage+CropRotate.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Categories/UIImage+CropRotate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// UIImage+CropRotate.m
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Constants/TOCropViewConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropViewConstants.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Models/TOActivityCroppedImageProvider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOActivityCroppedImageProvider.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Models/TOActivityCroppedImageProvider.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOActivityCroppedImageProvider.m
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Models/TOCropViewControllerTransitioning.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropViewControllerTransitioning.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Models/TOCropViewControllerTransitioning.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropViewControllerTransitioning.m
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Models/TOCroppedImageAttributes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCroppedImageAttributes.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Models/TOCroppedImageAttributes.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCroppedImageAttributes.m
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/TOCropViewController.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropViewController.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to
@@ -22,9 +22,15 @@
2222

2323
#import <UIKit/UIKit.h>
2424

25+
#if !__has_include(<TOCropViewController/TOCropViewConstants.h>)
2526
#import "TOCropViewConstants.h"
2627
#import "TOCropView.h"
2728
#import "TOCropToolbar.h"
29+
#else
30+
#import <TOCropViewController/TOCropViewConstants.h>
31+
#import <TOCropViewController/TOCropView.h>
32+
#import <TOCropViewController/TOCropToolbar.h>
33+
#endif
2834

2935
@class TOCropViewController;
3036

Objective-C/TOCropViewController/TOCropViewController.m

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropViewController.m
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to
@@ -84,7 +84,6 @@ - (instancetype)initWithCroppingStyle:(TOCropViewCroppingStyle)style image:(UIIm
8484
// Set up base view controller behaviour
8585
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
8686
self.modalPresentationStyle = UIModalPresentationFullScreen;
87-
self.automaticallyAdjustsScrollViewInsets = NO;
8887
self.hidesNavigationBar = true;
8988

9089
// Controller object that handles the transition animation when presenting / dismissing this app
@@ -242,6 +241,9 @@ - (UIStatusBarStyle)preferredStatusBarStyle
242241

243242
// Even though we are a dark theme, leave the status bar
244243
// as black so it's not obvious that it's still visible during the transition
244+
if (@available(iOS 13.0, *)) {
245+
return UIStatusBarStyleDarkContent;
246+
}
245247
return UIStatusBarStyleDefault;
246248
}
247249

@@ -660,6 +662,7 @@ - (void)setAspectRatioPreset:(TOCropViewControllerAspectRatioPreset)aspectRatioP
660662
break;
661663
case TOCropViewControllerAspectRatioPreset16x9:
662664
aspectRatio = CGSizeMake(16.0f, 9.0f);
665+
break;
663666
case TOCropViewControllerAspectRatioPreset16x6:
664667
aspectRatio = CGSizeMake(16.0f, 6.0f);
665668
break;
@@ -1285,32 +1288,22 @@ - (BOOL)statusBarHidden
12851288
- (CGFloat)statusBarHeight
12861289
{
12871290
CGFloat statusBarHeight = 0.0f;
1288-
if (@available(iOS 11.0, *)) {
1289-
statusBarHeight = self.view.safeAreaInsets.top;
1291+
statusBarHeight = self.view.safeAreaInsets.top;
12901292

1291-
// We do need to include the status bar height on devices
1292-
// that have a physical hardware inset, like an iPhone X notch
1293-
BOOL hardwareRelatedInset = self.view.safeAreaInsets.bottom > FLT_EPSILON
1294-
&& UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone;
1293+
// We do need to include the status bar height on devices
1294+
// that have a physical hardware inset, like an iPhone X notch
1295+
BOOL hardwareRelatedInset = self.view.safeAreaInsets.bottom > FLT_EPSILON
1296+
&& UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone;
12951297

1296-
// Always have insetting on Mac Catalyst
1297-
#if TARGET_OS_MACCATALYST
1298-
hardwareRelatedInset = YES;
1299-
#endif
1298+
// Always have insetting on Mac Catalyst
1299+
#if TARGET_OS_MACCATALYST
1300+
hardwareRelatedInset = YES;
1301+
#endif
13001302

1301-
// Unless the status bar is visible, or we need to account
1302-
// for a hardware notch, always treat the status bar height as zero
1303-
if (self.statusBarHidden && !hardwareRelatedInset) {
1304-
statusBarHeight = 0.0f;
1305-
}
1306-
}
1307-
else {
1308-
if (self.statusBarHidden) {
1309-
statusBarHeight = 0.0f;
1310-
}
1311-
else {
1312-
statusBarHeight = self.topLayoutGuide.length;
1313-
}
1303+
// Unless the status bar is visible, or we need to account
1304+
// for a hardware notch, always treat the status bar height as zero
1305+
if (self.statusBarHidden && !hardwareRelatedInset) {
1306+
statusBarHeight = 0.0f;
13141307
}
13151308

13161309
return statusBarHeight;
@@ -1319,14 +1312,8 @@ - (CGFloat)statusBarHeight
13191312
- (UIEdgeInsets)statusBarSafeInsets
13201313
{
13211314
UIEdgeInsets insets = UIEdgeInsetsZero;
1322-
if (@available(iOS 11.0, *)) {
1323-
insets = self.view.safeAreaInsets;
1324-
insets.top = self.statusBarHeight;
1325-
}
1326-
else {
1327-
insets.top = self.statusBarHeight;
1328-
}
1329-
1315+
insets = self.view.safeAreaInsets;
1316+
insets.top = self.statusBarHeight;
13301317
return insets;
13311318
}
13321319

Objective-C/TOCropViewController/Views/TOCropOverlayView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropOverlayView.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Views/TOCropOverlayView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropOverlayView.m
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Views/TOCropScrollView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropScrollView
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Views/TOCropScrollView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropScrollView
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Views/TOCropToolbar.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropToolbar.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to
@@ -21,7 +21,12 @@
2121
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2222

2323
#import <UIKit/UIKit.h>
24+
25+
#if !__has_include(<TOCropViewController/TOCropViewConstants.h>)
2426
#import "TOCropViewConstants.h"
27+
#else
28+
#import <TOCropViewController/TOCropViewConstants.h>
29+
#endif
2530

2631
NS_ASSUME_NONNULL_BEGIN
2732

Objective-C/TOCropViewController/Views/TOCropToolbar.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropToolbar.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewController/Views/TOCropView.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropView.h
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to
@@ -21,7 +21,12 @@
2121
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2222

2323
#import <UIKit/UIKit.h>
24+
25+
#if !__has_include(<TOCropViewController/TOCropViewConstants.h>)
2426
#import "TOCropViewConstants.h"
27+
#else
28+
#import <TOCropViewController/TOCropViewConstants.h>
29+
#endif
2530

2631
@class TOCropOverlayView;
2732
@class TOCropView;

Objective-C/TOCropViewController/Views/TOCropView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// TOCropView.m
33
//
4-
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Objective-C/TOCropViewControllerExample/Base.lproj/LaunchScreen.xib

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
33
<device id="retina6_5" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
7+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
78
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
89
</dependencies>
910
<objects>
@@ -13,7 +14,7 @@
1314
<rect key="frame" x="0.0" y="0.0" width="480" height="688"/>
1415
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1516
<subviews>
16-
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015-2020 Tim Oliver. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
17+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015-2024 Tim Oliver. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
1718
<rect key="frame" x="20" y="613" width="440" height="21"/>
1819
<fontDescription key="fontDescription" type="system" pointSize="17"/>
1920
<nil key="highlightedColor"/>
@@ -24,7 +25,7 @@
2425
<nil key="highlightedColor"/>
2526
</label>
2627
</subviews>
27-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
28+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
2829
<constraints>
2930
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
3031
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
@@ -38,4 +39,9 @@
3839
<point key="canvasLocation" x="548" y="85"/>
3940
</view>
4041
</objects>
42+
<resources>
43+
<systemColor name="systemBackgroundColor">
44+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
45+
</systemColor>
46+
</resources>
4147
</document>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ _Looking for something more? If `TOCropViewController` doesn't meet your exact r
3535
* Localized in 28 languages.
3636

3737
## System Requirements
38-
iOS 8.0 or above
38+
iOS 11.0 or above
3939

4040
## Installation
4141

Swift/CropViewController/CropViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// CropViewController.h
33
//
4-
// Copyright 2017-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2017-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

Swift/CropViewController/CropViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// CropViewController.swift
33
//
4-
// Copyright 2017-2022 Timothy Oliver. All rights reserved.
4+
// Copyright 2017-2024 Timothy Oliver. All rights reserved.
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to

0 commit comments

Comments
 (0)