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/swift concurrency #45

Merged
merged 16 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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
7 changes: 6 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ on:
branches:
- master

# See this page for available Xcode versions:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer

jobs:
build:

runs-on: macOS-latest
runs-on: macos-13

steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ name: CI

on: [pull_request]

# ???: (Alexandre Podlewski) 10/10/2023 Tests about NavigationObserver are failing when using Xcode 15.0 on CI,
# but pass locally, so we force Xcode 14.3.1 for now.

# See this page for available Xcode versions:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer

jobs:
build:

runs-on: macos-12
runs-on: macos-13

steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ name: Create release PRs
on:
create

# See this page for available Xcode versions:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer

jobs:
build:

runs-on: macOS-latest
runs-on: macos-13

if: contains(github.ref, 'release') # allow to filter on release branches only
steps:
Expand Down
8 changes: 4 additions & 4 deletions ADUtils.podspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Pod::Spec.new do |spec|
spec.name = 'ADUtils'
spec.version = '11.5.0'
spec.version = '12.0.0'
spec.authors = 'Fabernovel'
spec.homepage = 'https://github.com/faberNovel/ADUtils'
spec.summary = 'Fabernovel\'s toolbox for iOS'
spec.ios.deployment_target = '10.0'
spec.tvos.deployment_target = '10.0'
spec.ios.deployment_target = '13.0'
spec.tvos.deployment_target = '13.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'
spec.requires_arc = true
spec.default_subspec = 'objc'
spec.swift_versions = ['5.0', '5.1']
spec.swift_versions = ['5.7']

spec.subspec 'Swift' do |subspec|
# Subspec compliant with App extensions
Expand Down
31 changes: 24 additions & 7 deletions ADUtils.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -452,9 +452,10 @@
7A0EC6461535D8ED00E5F54A /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
CLASSPREFIX = AD;
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 1120;
LastUpgradeCheck = 1500;
TargetAttributes = {
49B1F77D1CE4B3DB00A29BFE = {
CreatedOnToolsVersion = 7.3;
Expand All @@ -471,11 +472,11 @@
};
buildConfigurationList = 7A0EC6491535D8ED00E5F54A /* Build configuration list for PBXProject "ADUtils" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
mainGroup = 7A0EC6441535D8ED00E5F54A;
packageReferences = (
Expand Down Expand Up @@ -520,6 +521,7 @@
/* Begin PBXShellScriptBuildPhase section */
490133B11C1EFC11000CC04B /* Turn TODO into Warning */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -530,10 +532,12 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "KEYWORDS=\"TODO:|FIXME:|\\?\\?\\?:|\\!\\!\\!:\"\nfind \"${SRCROOT}/Classes\" -name \"*.h\" -or -name \"*.m\" -print0 | xargs -0 egrep --with-filename --line-number --only-matching \"($KEYWORDS).*\\$\" | perl -p -e \"s/($KEYWORDS)/ warning: \\$1/\"";
shellScript = "KEYWORDS=\"TODO:|FIXME:|\\?\\?\\?:|\\!\\!\\!:\"\nfind \"${SRCROOT}/Classes\" -name \"*.h\" -or -name \"*.m\" -print0 | xargs -0 egrep --with-filename --line-number --only-matching \"($KEYWORDS).*\\$\" | perl -p -e \"s/($KEYWORDS)/ warning: \\$1/\"\n";
showEnvVarsInLog = 0;
};
490133B21C1EFC25000CC04B /* Warning if file > 250 lines */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -544,10 +548,12 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "find \"${SRCROOT}/Classes\" \\( -name \"*.h\" -or -name \"*.m\" \\) -and \\( -path \"${SRCROOT}/Pods/*\" -prune -o -print0 \\) | xargs -0 wc -l | awk '$1 > 250 && $2 != \"total\" {for(i=2;i<NF;i++){printf \"%s%s\", $i, \" \"} print $NF \":1: warning: File more than 250 lines (\" $1 \"), consider refactoring.\" }'";
shellScript = "find \"${SRCROOT}/Classes\" \\( -name \"*.h\" -or -name \"*.m\" \\) -and \\( -path \"${SRCROOT}/Pods/*\" -prune -o -print0 \\) | xargs -0 wc -l | awk '$1 > 250 && $2 != \"total\" {for(i=2;i<NF;i++){printf \"%s%s\", $i, \" \"} print $NF \":1: warning: File more than 250 lines (\" $1 \"), consider refactoring.\" }'\n";
showEnvVarsInLog = 0;
};
494C999A260205C500A1E098 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -563,9 +569,11 @@
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n";
showEnvVarsInLog = 0;
};
6FE3EFF61A6D3EB1007A4AD5 /* Patch Info.plist according to the environment */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -605,6 +613,7 @@
};
7A0EC66A1535D91400E5F54A /* Inject git informations in Info.plist */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -615,7 +624,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "GIT_COMMIT=`git rev-parse --short HEAD`\nGIT_BRANCH=`git symbolic-ref HEAD`\nGIT_STATUS=`git status --porcelain -z`\n/usr/libexec/PlistBuddy -c \"Delete :CFBundleGitCommit\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\" >/dev/null 2>&1\n/usr/libexec/PlistBuddy -c \"Delete :CFBundleGitBranch\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\" >/dev/null 2>&1\n/usr/libexec/PlistBuddy -c \"Delete :CFBundleGitStatus\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\" >/dev/null 2>&1\nif [ -n \"$GIT_COMMIT\" ]; then\n /usr/libexec/PlistBuddy -c \"Add :CFBundleGitCommit string \\\"${GIT_COMMIT}\\\"\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\nfi\nif [ -n \"$GIT_BRANCH\" ]; then\n /usr/libexec/PlistBuddy -c \"Add :CFBundleGitBranch string \\\"${GIT_BRANCH}\\\"\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\nfi\nif [ -n \"$GIT_STATUS\" ]; then\n /usr/libexec/PlistBuddy -c \"Add :CFBundleGitStatus string \\\"${GIT_STATUS}\\\"\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\nfi";
shellScript = "GIT_COMMIT=`git rev-parse --short HEAD`\nGIT_BRANCH=`git symbolic-ref HEAD`\nGIT_STATUS=`git status --porcelain -z`\n/usr/libexec/PlistBuddy -c \"Delete :CFBundleGitCommit\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\" >/dev/null 2>&1\n/usr/libexec/PlistBuddy -c \"Delete :CFBundleGitBranch\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\" >/dev/null 2>&1\n/usr/libexec/PlistBuddy -c \"Delete :CFBundleGitStatus\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\" >/dev/null 2>&1\nif [ -n \"$GIT_COMMIT\" ]; then\n /usr/libexec/PlistBuddy -c \"Add :CFBundleGitCommit string \\\"${GIT_COMMIT}\\\"\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\nfi\nif [ -n \"$GIT_BRANCH\" ]; then\n /usr/libexec/PlistBuddy -c \"Add :CFBundleGitBranch string \\\"${GIT_BRANCH}\\\"\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\nfi\nif [ -n \"$GIT_STATUS\" ]; then\n /usr/libexec/PlistBuddy -c \"Add :CFBundleGitStatus string \\\"${GIT_STATUS}\\\"\" \"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\nfi\n";
showEnvVarsInLog = 0;
};
A6A85E92266DAE1D134ACEEA /* [CP] Check Pods Manifest.lock */ = {
Expand Down Expand Up @@ -886,6 +895,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -914,6 +924,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down Expand Up @@ -965,6 +976,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -990,6 +1002,7 @@
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -1041,6 +1054,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -1068,6 +1082,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down Expand Up @@ -1119,6 +1134,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -1146,6 +1162,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
PROVISIONING_PROFILE_SPECIFIER = "$(PROFILE_UDID)";
SDKROOT = iphoneos;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/AttributedStringTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Quick
import ADUtils
@testable import ADUtilsApp

@MainActor
class AttributedStringTest: QuickSpec {

override class func spec() {
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/ChildInsertionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Quick
import ADUtils
@testable import ADUtilsApp

@MainActor
class ChildInsertionTest: QuickSpec {

override class func spec() {
Expand Down
2 changes: 2 additions & 0 deletions ADUtilsTests/DebouncedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ private enum Constants {
}

/// Test for regular Debouncer class
@MainActor
class DebouncerTests: QuickSpec {

override class func spec() {
Expand Down Expand Up @@ -82,6 +83,7 @@ class DebouncerTests: QuickSpec {
}

/// Test for property wrapper
@MainActor
class DebouncedTests: QuickSpec {

@Debounced(delay: Constants.delay, queue: .main)
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/DeselectableViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private class TransitionCoordinator: NSObject, UIViewControllerTransitionCoordin
}
}

@MainActor
class DeselectableViewTests: QuickSpec {

override class func spec() {
Expand Down
33 changes: 19 additions & 14 deletions ADUtilsTests/DynamicFontTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ import SnapshotTesting

private extension UIFont {

@MainActor
class func ad_mainFont(forTextStyle textStyle: UIFont.TextStyle) -> UIFont {
return FontHelper.shared.helveticaNeueDynamicFont.font(forTextStyle: textStyle)
}
}

private extension Font {

@MainActor
static func ad_mainFont(forTextStyle textStyle: Font.TextStyle) -> Font {
return FontHelper.shared.helveticaNeueDynamicFont.font(forTextStyle: textStyle)
}
}

@MainActor
private class FontHelper {

static let shared = FontHelper()
Expand All @@ -40,6 +43,7 @@ private class FontHelper {
}()
}

@MainActor
class DynamicFontTest: QuickSpec {

override class func spec() {
Expand All @@ -58,23 +62,24 @@ class DynamicFontTest: QuickSpec {
.caption1,
.caption2
]
let labels = types.map { (type) -> UILabel in
let label = UILabel()
label.font = UIFont.ad_mainFont(forTextStyle: type)
if #available(iOS 11.0, *) {
label.adjustsFontForContentSizeCategory = true

it("should layout labels properly") {
let labels = types.map { (type) -> UILabel in
let label = UILabel()
label.font = UIFont.ad_mainFont(forTextStyle: type)
if #available(iOS 11.0, *) {
label.adjustsFontForContentSizeCategory = true
}
label.text = "Lorem sizzle pimpin' sit amizzle"
label.numberOfLines = 0
return label
}
label.text = "Lorem sizzle pimpin' sit amizzle"
label.numberOfLines = 0
return label
}

let stackView = UIStackView(arrangedSubviews: labels)
stackView.frame = CGRect(x: 0.0, y: 0.0, width: 200.0, height: 1000.0)
stackView.axis = .vertical
stackView.distribution = .fillEqually
let stackView = UIStackView(arrangedSubviews: labels)
stackView.frame = CGRect(x: 0.0, y: 0.0, width: 200.0, height: 1000.0)
stackView.axis = .vertical
stackView.distribution = .fillEqually

it("should layout labels properly") {
stackView.layoutIfNeeded()
assertSnapshot(matching: stackView, as: .image, named: "DynamicFontLayoutTest")
assertSnapshot(
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/LayoutGuideConstraintsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SnapshotTesting
import Quick
import ADUtils

@MainActor
class LayoutGuideConstraintsTests: QuickSpec {

override class func spec() {
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/LayoutTests/ViewLayoutTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ADUtils
import Nimble
import UIKit

@MainActor
class ViewLayout: QuickSpec {

override class func spec() {
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/MKMapViewDequeuingTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class MapViewAnnotationView: MKAnnotationView {

}

@MainActor
class MKMapViewDequeuingTest: QuickSpec {
override class func spec() {
describe("Dequeuing") {
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/NSLayoutConstraintUtilsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Nimble
import ADUtils
import UIKit

@MainActor
class NSLayoutConstraintUtilsTests: QuickSpec {

override class func spec() {
Expand Down
1 change: 1 addition & 0 deletions ADUtilsTests/NavigationControllerObserverTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private class NavigationControllerDelegate: NSObject, UINavigationControllerDele
}
}

@MainActor
class NavigationControllerObserverTest : QuickSpec {

override class func spec() {
Expand Down
Loading
Loading