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

Support Dynamic Framework, Carthage, and Xcode 10 #24

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions MDFTextAccessibility.podspec
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
Pod::Spec.new do |spec|
spec.name = "MDFTextAccessibility"
spec.version = "2.0.0"
spec.version = "2.0.1"
spec.summary = "MDFTextAccessibility assists in selecting text colors that meet the W3C standards for accessibility."
spec.homepage = "https://github.com/google/material-text-accessibility-ios"
spec.license = "Apache License, Version 2.0"
spec.authors = "Google Inc."
spec.source = { :git => "https://github.com/google/material-text-accessibility-ios.git", :tag => "v#{spec.version}" }
spec.platform = :ios,:tvos
spec.source_files = "src/*.{h,m}", "src/private/*.{h,m}"
spec.public_header_files = "src/MDFTextAccessibility.h"
spec.public_header_files = "src/*.h"
spec.private_header_files = "src/private/*.h"
spec.header_dir = "MDFTextAccessibility"
spec.ios.deployment_target = '8.0'
spec.tvos.deployment_target = '9.0'
end
419 changes: 269 additions & 150 deletions MDFTextAccessibility.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,8 +14,8 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0B2890DE1CE2730C009E605A"
BuildableName = "libMDFTextAccessibility.a"
BlueprintIdentifier = "6D47A3D121F9F2E500572484"
BuildableName = "MDFTextAccessibility.framework"
BlueprintName = "MDFTextAccessibility"
ReferencedContainer = "container:MDFTextAccessibility.xcodeproj">
</BuildableReference>
Expand All @@ -26,25 +26,25 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0BDAE3DF1CECD3A6003323B9"
BuildableName = "MDFTextAccessibilityUnitTests.xctest"
BlueprintName = "MDFTextAccessibilityUnitTests"
BlueprintIdentifier = "6D47A3E621F9F47700572484"
BuildableName = "MDFTextAccessibilityTests.xctest"
BlueprintName = "MDFTextAccessibilityTests"
ReferencedContainer = "container:MDFTextAccessibility.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0B2890DE1CE2730C009E605A"
BuildableName = "libMDFTextAccessibility.a"
BlueprintIdentifier = "6D47A3D121F9F2E500572484"
BuildableName = "MDFTextAccessibility.framework"
BlueprintName = "MDFTextAccessibility"
ReferencedContainer = "container:MDFTextAccessibility.xcodeproj">
</BuildableReference>
Expand All @@ -65,8 +65,8 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0B2890DE1CE2730C009E605A"
BuildableName = "libMDFTextAccessibility.a"
BlueprintIdentifier = "6D47A3D121F9F2E500572484"
BuildableName = "MDFTextAccessibility.framework"
BlueprintName = "MDFTextAccessibility"
ReferencedContainer = "container:MDFTextAccessibility.xcodeproj">
</BuildableReference>
Expand All @@ -83,8 +83,8 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0B2890DE1CE2730C009E605A"
BuildableName = "libMDFTextAccessibility.a"
BlueprintIdentifier = "6D47A3D121F9F2E500572484"
BuildableName = "MDFTextAccessibility.framework"
BlueprintName = "MDFTextAccessibility"
ReferencedContainer = "container:MDFTextAccessibility.xcodeproj">
</BuildableReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6D47A3E621F9F47700572484"
BuildableName = "MDFTextAccessibilityTests.xctest"
BlueprintName = "MDFTextAccessibilityTests"
ReferencedContainer = "container:MDFTextAccessibility.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
22 changes: 22 additions & 0 deletions src/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>
17 changes: 0 additions & 17 deletions src/MDFTextAccessibility-Bridging-Header.h

This file was deleted.

5 changes: 0 additions & 5 deletions src/module.modulemap

This file was deleted.

22 changes: 22 additions & 0 deletions tests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
24 changes: 12 additions & 12 deletions tests/unit/MDFTextAccessibilityUnitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MDFTextAccessibilityUnitTests: XCTestCase {
let minAlpha = MDFTextAccessibility.minAlpha(ofTextColor: textColor,
onBackgroundColor:backgroundColor,
options:MDFTextAccessibilityOptions())
XCTAssertEqualWithAccuracy(minAlpha, 0.54, accuracy: alphaEpsilon)
XCTAssertEqual(minAlpha, 0.54, accuracy: alphaEpsilon)
}

func testLargeTextBlackOnWhiteMinAlpha() {
Expand All @@ -92,7 +92,7 @@ class MDFTextAccessibilityUnitTests: XCTestCase {
let minAlpha = MDFTextAccessibility.minAlpha(ofTextColor: textColor,
onBackgroundColor:backgroundColor,
options:MDFTextAccessibilityOptions.largeFont)
XCTAssertEqualWithAccuracy(minAlpha, 0.42, accuracy: alphaEpsilon)
XCTAssertEqual(minAlpha, 0.42, accuracy: alphaEpsilon)
}

func testMinAlphaIgnoresColorAlpha() {
Expand All @@ -107,7 +107,7 @@ class MDFTextAccessibilityUnitTests: XCTestCase {
onBackgroundColor:backgroundColor,
options:MDFTextAccessibilityOptions())

XCTAssertEqualWithAccuracy(minAlpha, minAlphaWithColorWithAlpha, accuracy: alphaEpsilon)
XCTAssertEqual(minAlpha, minAlphaWithColorWithAlpha, accuracy: alphaEpsilon)
}

// MARK: Accessibility standard tests
Expand Down Expand Up @@ -225,17 +225,17 @@ class MDFTextAccessibilityUnitTests: XCTestCase {
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 10)))

// Bold and thicker fonts are considered large at a lower font size than nonbold fonts.
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightBlack)))
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightHeavy)))
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightBold)))
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.black)))
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.heavy)))
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.bold)))
// Semibold is considered bold by iOS font-weight APIs: fontDescriptor.symbolicTraits & UIFontDescriptorTraitBold.
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightSemibold)))
XCTAssertTrue(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.semibold)))

// Non-bold fonts are not considered large at the lower font size threshold.
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightMedium)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightRegular)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightLight)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightThin)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFontWeightUltraLight)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.medium)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.regular)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.light)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.thin)))
XCTAssertFalse(MDFTextAccessibility.isLarge(forContrastRatios: UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.ultraLight)))
}
}