Skip to content

Commit

Permalink
Merge branch 'release/5.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Jul 8, 2022
2 parents 8fb77ea + a30789b commit 2b31bd9
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 40 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ xcuserdata
/fastlane/*.xml

/vendor
/.bundle
/.bundle

.vscode
2 changes: 1 addition & 1 deletion Demo/Demo.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version information
MARKETING_VERSION = 5.1.0
MARKETING_VERSION = 5.1.1

// Deployment targets
IPHONEOS_DEPLOYMENT_TARGET = 12.0
Expand Down
60 changes: 30 additions & 30 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.554.0)
aws-sdk-core (3.126.0)
aws-partitions (1.597.0)
aws-sdk-core (3.131.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.54.0)
aws-sdk-core (~> 3, >= 3.126.0)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.57.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.112.0)
aws-sdk-core (~> 3, >= 3.126.0)
aws-sdk-s3 (1.114.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.4.0)
aws-sigv4 (1.5.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.0.3)
Expand All @@ -36,8 +36,8 @@ GEM
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
emoji_regex (3.2.3)
excon (0.91.0)
faraday (1.9.3)
excon (0.92.3)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
Expand All @@ -56,8 +56,8 @@ GEM
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
Expand All @@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.204.3)
fastlane (2.206.2)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -106,9 +106,9 @@ GEM
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.16.0)
google-apis-androidpublisher_v3 (0.21.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-core (0.4.2)
google-apis-core (0.5.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
Expand All @@ -121,36 +121,36 @@ GEM
google-apis-core (>= 0.4, < 2.a)
google-apis-playcustomapp_v1 (0.7.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-storage_v1 (0.11.0)
google-apis-storage_v1 (0.14.0)
google-apis-core (>= 0.4, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.5.0)
faraday (>= 0.17.3, < 2.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.2.0)
google-cloud-storage (1.36.1)
google-cloud-storage (1.36.2)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.1)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.1.1)
faraday (>= 0.17.3, < 2.0)
googleauth (1.1.3)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.6.0)
json (2.6.1)
jwt (2.3.0)
jmespath (1.6.1)
json (2.6.2)
jwt (2.4.1)
memoist (0.16.2)
mini_magick (4.11.0)
mini_mime (1.1.2)
Expand All @@ -161,9 +161,9 @@ GEM
optparse (0.1.1)
os (1.1.4)
plist (3.6.0)
public_suffix (4.0.6)
public_suffix (4.0.7)
rake (13.0.6)
representable (3.1.1)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
Expand All @@ -173,9 +173,9 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.16.0)
signet (0.16.1)
addressable (~> 2.8)
faraday (>= 0.17.3, < 2.0)
faraday (>= 0.17.5, < 3.0)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.8)
Expand All @@ -192,7 +192,7 @@ GEM
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.7.0)
word_wrap (1.0.0)
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ test-tvos:
@xcodebuild test -scheme SRGAppearance -destination 'platform=tvOS Simulator,name=Apple TV' 2> /dev/null
@echo "... done.\n"

.PHONY: lint
lint:
@echo "Linting project..."
@swiftlint --fix && swiftlint
@echo "... done.\n"

.PHONY: help
help:
@echo "The following targets are available:"
@echo " all Build and run unit tests for all platforms"
@echo " lint Lint project and fix issues"
@echo " test-ios Build and run unit tests for iOS"
@echo " test-tvos Build and run unit tests for tvOS"
@echo " help Display this help message"
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription

struct ProjectSettings {
static let marketingVersion: String = "5.1.0"
static let marketingVersion: String = "5.1.1"
}

let package = Package(
Expand Down
15 changes: 10 additions & 5 deletions Sources/SRGAppearance/SRGFont.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
const UIFontWeight SRGFontWeightBold = 1.f / 3.f; // 700 = 300 + (900 - 300) * (1/3 + 1) / 2
const UIFontWeight SRGFontWeightHeavy = 1.f; // 900 = 300 + (900 - 300) * (1 + 1) / 2

// Identifier of the weight axis
static const NSInteger SRGFontWeightAxisIdentifier = 2003265652;

NSComparisonResult SRGAppearanceCompareContentSizeCategories(UIContentSizeCategory contentSizeCategory1, UIContentSizeCategory contentSizeCategory2)
{
if ([contentSizeCategory1 isEqualToString:contentSizeCategory2]) {
Expand Down Expand Up @@ -70,10 +73,10 @@ NSComparisonResult SRGAppearanceCompareContentSizeCategories(UIContentSizeCatego
return fontName;
}

static SRGVariationAxis *SRGVariationAxisWithName(SRGFontFamily family, NSString *axisName)
static SRGVariationAxis *SRGVariationAxisWithIdentifier(SRGFontFamily family, NSNumber *identifier)
{
NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(SRGVariationAxis * _Nullable variationAxis, NSDictionary<NSString *,id> * _Nullable bindings) {
return [variationAxis.name isEqualToString:axisName];
return [variationAxis.identifier isEqualToNumber:identifier];
}];
return [[SRGVariationAxis variationAxesForFontWithName:SRGFontNameForFamily(family)] filteredArrayUsingPredicate:predicate].firstObject;
}
Expand Down Expand Up @@ -300,15 +303,17 @@ + (UIFontDescriptor *)fontDescriptorForFontWithFamily:(SRGFontFamily)family weig
if (! fontDescriptor) {
NSMutableDictionary<UIFontDescriptorAttributeName, id> *variationAttributes = [NSMutableDictionary dictionary];

SRGVariationAxis *variationAxis = SRGVariationAxisWithName(family, @"Weight");
SRGVariationAxis *variationAxis = SRGVariationAxisWithIdentifier(family, @(SRGFontWeightAxisIdentifier));
if (variationAxis) {
// UIFont weight is a value between -1 and 1, which must be translated to the axis supported range
CGFloat absoluteWeight = variationAxis.minimumValue + (variationAxis.maximumValue - variationAxis.minimumValue) * (weight + 1.f) / 2.f;
variationAttributes[variationAxis.identifier] = @(absoluteWeight);
}

fontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:@{ UIFontDescriptorNameAttribute : SRGFontNameForFamily(family),
(UIFontDescriptorAttributeName)kCTFontVariationAttribute : variationAttributes.copy }];
fontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:@{
UIFontDescriptorNameAttribute : SRGFontNameForFamily(family),
(UIFontDescriptorAttributeName)kCTFontVariationAttribute : variationAttributes.copy
}];
fontDescriptorsForFamilyMap[@(weight)] = fontDescriptor;
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/SRGAppearance/SRGVariationAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly, copy) NSNumber *identifier;

/**
* Name of the axis.
* Name of the axis (localized in the current language).
*/
@property (nonatomic, readonly, copy) NSString *name;

Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def srg_xcodebuild(device, test_build)
end

def srg_test_xcargs
'-retry-tests-on-failure'
'-retry-tests-on-failure -testLanguage en -testRegion en-US'
end

def srg_xcodebuild_workspace(test_build)
Expand Down

0 comments on commit 2b31bd9

Please sign in to comment.