Skip to content

Commit

Permalink
Merge pull request #571 from TimOliver/xcode-15-support
Browse files Browse the repository at this point in the history
Update project for Xcode 15 and iOS 17
  • Loading branch information
TimOliver authored Apr 6, 2024
2 parents 5b72b20 + b3e78d1 commit 4665994
Show file tree
Hide file tree
Showing 34 changed files with 186 additions and 118 deletions.
2 changes: 1 addition & 1 deletion CropViewController.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Pod::Spec.new do |s|
s.homepage = 'https://github.com/TimOliver/TOCropViewController'
s.author = 'Tim Oliver'
s.source = { :git => 'https://github.com/TimOliver/TOCropViewController.git', :tag => s.version }
s.platform = :ios, '8.0'
s.platform = :ios, '11.0'
s.source_files = 'Swift/CropViewController/**/*.{h,swift}', 'Objective-C/TOCropViewController/**/*.{h,m}'
s.exclude_files = 'Objective-C/TOCropViewController/include/**/*.h'
s.resource_bundles = {
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2022 Tim Oliver
Copyright (c) 2015-2024 Tim Oliver

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// UIImage+CropRotate.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// UIImage+CropRotate.m
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropViewConstants.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOActivityCroppedImageProvider.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOActivityCroppedImageProvider.m
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropViewControllerTransitioning.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropViewControllerTransitioning.m
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCroppedImageAttributes.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCroppedImageAttributes.m
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
8 changes: 7 additions & 1 deletion Objective-C/TOCropViewController/TOCropViewController.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropViewController.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand All @@ -22,9 +22,15 @@

#import <UIKit/UIKit.h>

#if !__has_include(<TOCropViewController/TOCropViewConstants.h>)
#import "TOCropViewConstants.h"
#import "TOCropView.h"
#import "TOCropToolbar.h"
#else
#import <TOCropViewController/TOCropViewConstants.h>
#import <TOCropViewController/TOCropView.h>
#import <TOCropViewController/TOCropToolbar.h>
#endif

@class TOCropViewController;

Expand Down
53 changes: 20 additions & 33 deletions Objective-C/TOCropViewController/TOCropViewController.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropViewController.m
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -84,7 +84,6 @@ - (instancetype)initWithCroppingStyle:(TOCropViewCroppingStyle)style image:(UIIm
// Set up base view controller behaviour
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
self.modalPresentationStyle = UIModalPresentationFullScreen;
self.automaticallyAdjustsScrollViewInsets = NO;
self.hidesNavigationBar = true;

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

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

Expand Down Expand Up @@ -660,6 +662,7 @@ - (void)setAspectRatioPreset:(TOCropViewControllerAspectRatioPreset)aspectRatioP
break;
case TOCropViewControllerAspectRatioPreset16x9:
aspectRatio = CGSizeMake(16.0f, 9.0f);
break;
case TOCropViewControllerAspectRatioPreset16x6:
aspectRatio = CGSizeMake(16.0f, 6.0f);
break;
Expand Down Expand Up @@ -1285,32 +1288,22 @@ - (BOOL)statusBarHidden
- (CGFloat)statusBarHeight
{
CGFloat statusBarHeight = 0.0f;
if (@available(iOS 11.0, *)) {
statusBarHeight = self.view.safeAreaInsets.top;
statusBarHeight = self.view.safeAreaInsets.top;

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

// Always have insetting on Mac Catalyst
#if TARGET_OS_MACCATALYST
hardwareRelatedInset = YES;
#endif
// Always have insetting on Mac Catalyst
#if TARGET_OS_MACCATALYST
hardwareRelatedInset = YES;
#endif

// Unless the status bar is visible, or we need to account
// for a hardware notch, always treat the status bar height as zero
if (self.statusBarHidden && !hardwareRelatedInset) {
statusBarHeight = 0.0f;
}
}
else {
if (self.statusBarHidden) {
statusBarHeight = 0.0f;
}
else {
statusBarHeight = self.topLayoutGuide.length;
}
// Unless the status bar is visible, or we need to account
// for a hardware notch, always treat the status bar height as zero
if (self.statusBarHidden && !hardwareRelatedInset) {
statusBarHeight = 0.0f;
}

return statusBarHeight;
Expand All @@ -1319,14 +1312,8 @@ - (CGFloat)statusBarHeight
- (UIEdgeInsets)statusBarSafeInsets
{
UIEdgeInsets insets = UIEdgeInsetsZero;
if (@available(iOS 11.0, *)) {
insets = self.view.safeAreaInsets;
insets.top = self.statusBarHeight;
}
else {
insets.top = self.statusBarHeight;
}

insets = self.view.safeAreaInsets;
insets.top = self.statusBarHeight;
return insets;
}

Expand Down
2 changes: 1 addition & 1 deletion Objective-C/TOCropViewController/Views/TOCropOverlayView.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropOverlayView.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
2 changes: 1 addition & 1 deletion Objective-C/TOCropViewController/Views/TOCropOverlayView.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropOverlayView.m
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
2 changes: 1 addition & 1 deletion Objective-C/TOCropViewController/Views/TOCropScrollView.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropScrollView
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
2 changes: 1 addition & 1 deletion Objective-C/TOCropViewController/Views/TOCropScrollView.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropScrollView
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
7 changes: 6 additions & 1 deletion Objective-C/TOCropViewController/Views/TOCropToolbar.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropToolbar.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand All @@ -21,7 +21,12 @@
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <UIKit/UIKit.h>

#if !__has_include(<TOCropViewController/TOCropViewConstants.h>)
#import "TOCropViewConstants.h"
#else
#import <TOCropViewController/TOCropViewConstants.h>
#endif

NS_ASSUME_NONNULL_BEGIN

Expand Down
2 changes: 1 addition & 1 deletion Objective-C/TOCropViewController/Views/TOCropToolbar.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropToolbar.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
7 changes: 6 additions & 1 deletion Objective-C/TOCropViewController/Views/TOCropView.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropView.h
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand All @@ -21,7 +21,12 @@
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <UIKit/UIKit.h>

#if !__has_include(<TOCropViewController/TOCropViewConstants.h>)
#import "TOCropViewConstants.h"
#else
#import <TOCropViewController/TOCropViewConstants.h>
#endif

@class TOCropOverlayView;
@class TOCropView;
Expand Down
2 changes: 1 addition & 1 deletion Objective-C/TOCropViewController/Views/TOCropView.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// TOCropView.m
//
// Copyright 2015-2022 Timothy Oliver. All rights reserved.
// Copyright 2015-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<device id="retina6_5" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -13,7 +14,7 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="688"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<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">
<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">
<rect key="frame" x="20" y="613" width="440" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
Expand All @@ -24,7 +25,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
Expand All @@ -38,4 +39,9 @@
<point key="canvasLocation" x="548" y="85"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ _Looking for something more? If `TOCropViewController` doesn't meet your exact r
* Localized in 28 languages.

## System Requirements
iOS 8.0 or above
iOS 11.0 or above

## Installation

Expand Down
2 changes: 1 addition & 1 deletion Swift/CropViewController/CropViewController.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// CropViewController.h
//
// Copyright 2017-2022 Timothy Oliver. All rights reserved.
// Copyright 2017-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
2 changes: 1 addition & 1 deletion Swift/CropViewController/CropViewController.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// CropViewController.swift
//
// Copyright 2017-2022 Timothy Oliver. All rights reserved.
// Copyright 2017-2024 Timothy Oliver. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down
Loading

0 comments on commit 4665994

Please sign in to comment.