Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update to ios 14 #46

Merged
merged 5 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ADUtils.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Pod::Spec.new do |spec|
spec.authors = 'Fabernovel'
spec.homepage = 'https://github.com/faberNovel/ADUtils'
spec.summary = 'Fabernovel\'s toolbox for iOS'
spec.ios.deployment_target = '13.0'
spec.tvos.deployment_target = '13.0'
spec.ios.deployment_target = '14.0'
spec.tvos.deployment_target = '14.0'
spec.license = { :type => 'MIT', :text => 'Created and licensed by Fabernovel Technologies. Copyright 2014-2018 Fabernovel Technologies. All rights reserved.' }
spec.source = { :git => 'https://github.com/faberNovel/ADUtils.git', :tag => "v#{spec.version}" }
spec.framework = 'Foundation', 'UIKit'
Expand Down
8 changes: 4 additions & 4 deletions ADUtils.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
SWIFT_STRICT_CONCURRENCY = complete;
Expand Down Expand Up @@ -998,7 +998,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1079,7 +1079,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
SWIFT_STRICT_CONCURRENCY = complete;
Expand Down Expand Up @@ -1159,7 +1159,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
SWIFT_STRICT_CONCURRENCY = complete;
Expand Down
144 changes: 71 additions & 73 deletions ADUtilsTests/ADLayoutGuideTestsObjc.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,79 +118,77 @@ - (void)spec {
});
});

if (@available(iOS 13.0, *)) {
describe(@"Should not translate autoresizing mask into constaints", ^{

__block UIView * view;
__block UILayoutGuide * layoutGuide;

beforeEach(^{
view = [UIView new];
layoutGuide = [UILayoutGuide new];
[view addLayoutGuide:layoutGuide];
});

// Pin to superview

it(@"Pin to superview", ^{
[layoutGuide ad_pinToOwningViewUsingDirectionalEdges:YES];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview edges", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview insets", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalInsets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview edges insets", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview edges insets priority", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(view.constraints.count).to(equal(4));
});

// Constrain in superview

it(@"Constrain in superview", ^{
[layoutGuide ad_constrainInOwningViewUsingDirectionalEdges:YES];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview edges", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview insets", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalInsets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview edges insets", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview edges insets priority", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(view.constraints.count).to(equal(4));
});
});
}
describe(@"Should not translate autoresizing mask into constaints", ^{

__block UIView * view;
__block UILayoutGuide * layoutGuide;

beforeEach(^{
view = [UIView new];
layoutGuide = [UILayoutGuide new];
[view addLayoutGuide:layoutGuide];
});

// Pin to superview

it(@"Pin to superview", ^{
[layoutGuide ad_pinToOwningViewUsingDirectionalEdges:YES];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview edges", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview insets", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalInsets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview edges insets", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Pin to superview edges insets priority", ^{
[layoutGuide ad_pinToOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(view.constraints.count).to(equal(4));
});

// Constrain in superview

it(@"Constrain in superview", ^{
[layoutGuide ad_constrainInOwningViewUsingDirectionalEdges:YES];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview edges", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview insets", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalInsets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview edges insets", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(view.constraints.count).to(equal(4));
});

it(@"Constrain in superview edges insets priority", ^{
[layoutGuide ad_constrainInOwningViewWithDirectionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(view.constraints.count).to(equal(4));
});
});
}

@end
166 changes: 82 additions & 84 deletions ADUtilsTests/ADViewLayoutGuideTestsObjc.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,90 +112,88 @@ - (void)spec {
});
});

if (@available(iOS 13.0, *)) {
describe(@"Should not translate autoresizing mask into constaints using directional edges and insets", ^{

__block UIView * view;
__block UIView * subview;

beforeEach(^{
view = [UIView new];
subview = [UIView new];
[view addSubview:subview];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beTrue());
});

// Pin to layout guide

it(@"Pin to layout guide", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide usingDirectionalEdges:YES];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide directionalEdges:NSDirectionalRectEdgeAll];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide insets", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide insets:UIEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges insets", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges insets", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide
directionalInsets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges insets priority", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero priority:UILayoutPriorityRequired];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

// Constrain in layout guide

it(@"Constrain in layout guide", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide usingDirectionalEdges:YES];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide edges", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide directionalEdges:NSDirectionalRectEdgeAll];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide insets", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide directionalInsets:NSDirectionalEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide edges insets", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide edges insets priority", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});
});
}
describe(@"Should not translate autoresizing mask into constaints using directional edges and insets", ^{

__block UIView * view;
__block UIView * subview;

beforeEach(^{
view = [UIView new];
subview = [UIView new];
[view addSubview:subview];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beTrue());
});

// Pin to layout guide

it(@"Pin to layout guide", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide usingDirectionalEdges:YES];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide directionalEdges:NSDirectionalRectEdgeAll];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide insets", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide insets:UIEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges insets", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges insets", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide
directionalInsets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Pin to layout guide edges insets priority", ^{
[subview ad_pinToLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero priority:UILayoutPriorityRequired];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

// Constrain in layout guide

it(@"Constrain in layout guide", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide usingDirectionalEdges:YES];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide edges", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide directionalEdges:NSDirectionalRectEdgeAll];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide insets", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide directionalInsets:NSDirectionalEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide edges insets", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});

it(@"Constrain in layout guide edges insets priority", ^{
[subview ad_constrainInLayoutGuide:view.layoutMarginsGuide
directionalEdges:NSDirectionalRectEdgeAll
insets:NSDirectionalEdgeInsetsZero
priority:UILayoutPriorityRequired];
expect(subview.translatesAutoresizingMaskIntoConstraints).to(beFalse());
});
});
}

@end
Loading
Loading