Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit cd986a4

Browse files
committed
Merge branch 'release-candidate' into stable
2 parents 499b45d + c59458e commit cd986a4

File tree

9 files changed

+65
-23
lines changed

9 files changed

+65
-23
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 2.0.1
2+
3+
This patch release adds Swift Package Manager support.
4+
5+
* [Adding SPM Support](https://github.com/material-foundation/material-text-accessibility-ios/commit/5b185245864e6b58d6b26dfbe5cd4447e4fda2b4) (DomenicBianchi01)
6+
* [Internal change](https://github.com/material-foundation/material-text-accessibility-ios/commit/191c0f3eb2b38b29d74338c891cf1acecc74bb44) (Andrew Overton)
7+
* [Internal change](https://github.com/material-foundation/material-text-accessibility-ios/commit/3f21de715f00813ddae1a5f7e9aa7dc8a1ff3ae1) (Andrew Overton)
8+
* [Internal change](https://github.com/material-foundation/material-text-accessibility-ios/commit/36ddff44400af3d906ba842d3edb6276d4454d60) (Andrew Overton)
9+
* [Internal change](https://github.com/material-foundation/material-text-accessibility-ios/commit/f5b3d221f3a633c5ddff5309141fee7d9e01a8bb) (Andrew Overton)
10+
111
# 2.0.0
212

313
This major release upgrades the bazel dependencies and workspace. This change is breaking for anyone

MDFTextAccessibility.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "MDFTextAccessibility"
3-
spec.version = "2.0.0"
3+
spec.version = "2.0.1"
44
spec.summary = "MDFTextAccessibility assists in selecting text colors that meet the W3C standards for accessibility."
55
spec.homepage = "https://github.com/google/material-text-accessibility-ios"
66
spec.license = "Apache License, Version 2.0"

Package.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// swift-tools-version:5.3
2+
3+
// Copyright 2020-present the Material Text Accessibility for iOS authors. All Rights Reserved.
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
import PackageDescription
18+
19+
let package = Package(
20+
name: "MDFTextAccessibility",
21+
platforms: [
22+
.iOS("8.0"), .tvOS("9.0")
23+
],
24+
products: [
25+
.library(name: "MDFTextAccessibility", targets: ["MDFTextAccessibility"])
26+
],
27+
targets: [
28+
.target(
29+
name: "MDFTextAccessibility",
30+
path: "src",
31+
publicHeadersPath: ".")
32+
]
33+
)

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ swift_rules_dependencies()
4444
git_repository(
4545
name = "bazel_ios_warnings",
4646
remote = "https://github.com/material-foundation/bazel_ios_warnings.git",
47-
tag = "v2.0.0",
47+
tag = "v2.0.1",
4848
)
4949

5050
http_file(

examples/apps/MDFTextAccessibilitySample/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
platform :ios, '9.3'
1+
platform :ios, '10'
22
use_frameworks!
33

44
target 'MDFTextAccessibilitySample' do

src/MDFTextAccessibility.m

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
#import "MDFTextAccessibility.h"
1818

19-
#import "private/MDFColorCalculations.h"
20-
#import "private/MDFImageCalculations.h"
21-
#import "private/NSArray+MDFUtils.h"
19+
#import "MDFColorCalculations.h"
20+
#import "MDFImageCalculations.h"
21+
#import "NSArray+MDFUtils.h"
2222

2323
static const CGFloat kMinContrastRatioNormalText = 4.5f;
2424
static const CGFloat kMinContrastRatioLargeText = 3.0f;
@@ -48,19 +48,21 @@ + (nullable UIColor *)textColorOnBackgroundImage:(nonnull UIImage *)backgroundIm
4848
return nil;
4949
}
5050

51-
return
52-
[self textColorOnBackgroundColor:backgroundColor targetTextAlpha:targetTextAlpha font:font];
51+
return [self textColorOnBackgroundColor:backgroundColor
52+
targetTextAlpha:targetTextAlpha
53+
font:font];
5354
}
5455

5556
+ (nullable UIColor *)textColorOnBackgroundColor:(nonnull UIColor *)backgroundColor
5657
targetTextAlpha:(CGFloat)targetTextAlpha
5758
options:(MDFTextAccessibilityOptions)options {
5859
NSArray *colors = @[
59-
[UIColor colorWithWhite:1 alpha:targetTextAlpha],
60-
[UIColor colorWithWhite:0 alpha:targetTextAlpha]
60+
[UIColor colorWithWhite:1 alpha:targetTextAlpha], [UIColor colorWithWhite:0
61+
alpha:targetTextAlpha]
6162
];
62-
UIColor *textColor =
63-
[self textColorFromChoices:colors onBackgroundColor:backgroundColor options:options];
63+
UIColor *textColor = [self textColorFromChoices:colors
64+
onBackgroundColor:backgroundColor
65+
options:options];
6466
return textColor;
6567
}
6668

@@ -107,8 +109,9 @@ + (nullable UIColor *)textColorFromChoices:(nonnull NSArray<UIColor *> *)choices
107109
}
108110

109111
CGFloat alpha = CGColorGetAlpha(choice.CGColor);
110-
CGFloat minAlpha =
111-
[self minAlphaOfTextColor:choice onBackgroundColor:backgroundColor options:options];
112+
CGFloat minAlpha = [self minAlphaOfTextColor:choice
113+
onBackgroundColor:backgroundColor
114+
options:options];
112115
if (minAlpha > 0) {
113116
if (alpha > minAlpha) {
114117
NSAssert(NO,

src/module.modulemap

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/private/MDFColorCalculations.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ CGFloat MDFRelativeLuminanceOfRGBComponents(const CGFloat *components) {
123123
return 0.2126f * linearRGB[0] + 0.7152f * linearRGB[1] + 0.0722f * linearRGB[2];
124124
}
125125

126-
CGFloat MDFMinAlphaOfColorOnBackgroundColor(UIColor *color,
127-
UIColor *backgroundColor,
126+
CGFloat MDFMinAlphaOfColorOnBackgroundColor(UIColor *color, UIColor *backgroundColor,
128127
CGFloat minContrastRatio) {
129128
CGFloat colorComponents[4];
130129
CGFloat backgroundColorComponents[4];

src/private/MDFImageCalculations.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@
4545

4646
CGFloat alpha = argb[0] / (CGFloat)255;
4747
CGFloat scale = alpha > 0 ? 1 / (alpha * 255) : 0;
48-
UIColor *color =
49-
[UIColor colorWithRed:scale * argb[1] green:scale * argb[2] blue:scale * argb[3] alpha:alpha];
48+
UIColor *color = [UIColor colorWithRed:scale * argb[1]
49+
green:scale * argb[2]
50+
blue:scale * argb[3]
51+
alpha:alpha];
5052
UIGraphicsEndImageContext();
5153
return color;
5254
}

0 commit comments

Comments
 (0)