Skip to content
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
36 changes: 22 additions & 14 deletions .github/workflows/validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,40 @@ jobs:
needs: [lint]

steps:
- uses: actions/checkout@v2
- name: Setup Swift
uses: SwiftyLab/setup-swift@latest

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 200

- name: "Run xcodebuild"
- name: Setup XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.2'

- name: Selecting XCode Version
run: sudo xcode-select -switch /Applications/Xcode_16.2.app

- name: Install iOS platform
run: |
xcodebuild -downloadPlatform iOS -buildVersion 18.2

- name: List available simulators (debug)
run: xcrun simctl list devices

- name: Run xcodebuild
env:
XCODE_PROJECT: "Swissors.xcodeproj"
XCODE_SCHEME: "Swissors"
SIMULATOR_NAME: "iPhone 11"
run: |
set -o pipefail
xcodebuild -version
xcodebuild -showsdks
env NSUnbufferedIO=YES xcodebuild build \
-project "${XCODE_PROJECT}" \
-scheme "${XCODE_SCHEME}" \
-configuration Debug \
-destination "platform=iOS Simulator,name=${SIMULATOR_NAME}" \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.2" \
-derivedDataPath "DerivedData" \
COMPILER_INDEX_STORE_ENABLE=NO \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
ONLY_ACTIVE_ARCH=YES \
ENABLE_TESTABILITY=YES \
DEBUG_INFORMATION_FORMAT="dwarf" \
GCC_OPTIMIZATION_LEVEL="0" \
SWIFT_COMPILATION_MODE="singlefile" \
SWIFT_OPTIMIZATION_LEVEL="-Onone" \
| xcpretty
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
.build/
xcuserdata/
xcshareddata/*

# Swiift Package
DerivedData/
.swiftpm
build/

# Carthage
Carthage/Build
Expand Down
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ excluded:

# Uncomment and configure this in project's branch
deployment_target:
iOS_deployment_target: "8.0"
iOS_deployment_target: "12.0"
# macOS_deployment_target: "10.14"
# watchOS_deployment_target: "5.0"
# tvOS_deployment_target: "12.0"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016 e-Legion
Copyright (c) 2025 e-Legion

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// swift-tools-version:5.0
// swift-tools-version:6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Swissors",
platforms: [
.iOS(.v11),
.iOS(.v12),
],
products: [
.library(
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@

## Requirements

Swift 5.0, Xcode 10.2
Swift 6.0, Xcode 16.2

## Installation

With CocoaPods:

```
source 'https://github.com/elegion/ios-podspecs.git'

pod 'Swissors'
```
With Swift Package Manager only.

## Author

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
extension DispatchQueue {

class var currentLabel: String {
String(validatingUTF8: __dispatch_queue_get_label(nil)) ?? "unknown"
String(cString: __dispatch_queue_get_label(nil))
}

func safeSerialSync(execute block: @escaping () -> Void) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2017 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension NSLayoutConstraint {
Expand All @@ -22,3 +23,4 @@ public extension NSLayoutConstraint {
with(priority: priority)
}
}
#endif
14 changes: 6 additions & 8 deletions Sources/Swissors/Extensions/UIKit/UIApplication+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2016 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UIApplication {
Expand Down Expand Up @@ -35,13 +36,8 @@ public extension UIApplication {
emptyController.present(viewController, animated: animated, completion: nil)
}

func openURL(_ url: URL, completionHandler completion: ((Bool) -> Void)? = nil) {
if #available(iOS 10.0, *) {
self.open(url, options: [:], completionHandler: completion)
} else {
let result = self.openURL(url)
completion?(result)
}
func openURL(_ url: URL, completionHandler completion: (@MainActor @Sendable (Bool) -> Void)? = nil) {
self.open(url, options: [:], completionHandler: completion)
}

// MARK: Deprecated
Expand All @@ -63,7 +59,9 @@ public extension UIApplication {
}

@available(*, deprecated, renamed: "openURL")
func sw_openURL(_ url: URL, completionHandler completion: ((Bool) -> Void)? = nil) {
func sw_openURL(_ url: URL, completionHandler completion: (@MainActor @Sendable (Bool) -> Void)? = nil) {
openURL(url, completionHandler: completion)
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2016 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UICollectionView {
Expand Down Expand Up @@ -71,3 +72,5 @@ public extension UICollectionView {
dequeueHeaderFooter(of: viewType, kind: kind, for: indexPath)
}
}

#endif
2 changes: 2 additions & 0 deletions Sources/Swissors/Extensions/UIKit/UIColor+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
#if canImport(UIKit)
import UIKit

public extension UIColor {
Expand Down Expand Up @@ -223,3 +224,4 @@ public extension CGColor {
uiColor
}
}
#endif
3 changes: 3 additions & 0 deletions Sources/Swissors/Extensions/UIKit/UIEdgeInsets+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by viktor.volkov on 15.04.2022.
//

#if canImport(UIKit)
import UIKit

public extension UIEdgeInsets {
Expand Down Expand Up @@ -104,3 +105,5 @@ public extension UIEdgeInsets {
self.init(top: vertical, left: .zero, bottom: vertical, right: right)
}
}

#endif
5 changes: 5 additions & 0 deletions Sources/Swissors/Extensions/UIKit/UIImage+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2017 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UIImage {
Expand Down Expand Up @@ -82,6 +83,7 @@ public extension UIImage {
}
}

@MainActor
class func ovalImage(with size: CGSize, color: UIColor, fill: Bool) -> UIImage? {
image(with: size) {
_, rect in
Expand Down Expand Up @@ -155,6 +157,7 @@ public extension UIImage {
}

@available(*, deprecated, renamed: "ovalImage")
@MainActor
class func sw_ovalImage(with size: CGSize, color: UIColor, fill: Bool) -> UIImage? {
ovalImage(with: size, color: color, fill: fill)
}
Expand All @@ -164,3 +167,5 @@ public extension UIImage {
alphaBlended(with: color)
}
}

#endif
2 changes: 2 additions & 0 deletions Sources/Swissors/Extensions/UIKit/UINib+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2017 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UINib {
Expand All @@ -18,3 +19,4 @@ public extension UINib {
self.init(nibName: name, bundle: bundle)
}
}
#endif
3 changes: 3 additions & 0 deletions Sources/Swissors/Extensions/UIKit/UIRectCorner+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
// Copyright © 2017 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UIRectCorner {

static let bottom: UIRectCorner = [.bottomLeft, .bottomRight]
static let top: UIRectCorner = [.topLeft, .topRight]
}

#endif
2 changes: 2 additions & 0 deletions Sources/Swissors/Extensions/UIKit/UIStackView+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by viktor.volkov on 15.04.2022.
//

#if canImport(UIKit)
import UIKit

public extension UIStackView {
Expand Down Expand Up @@ -52,3 +53,4 @@ public extension UIStackView {
return removedSubviews
}
}
#endif
3 changes: 3 additions & 0 deletions Sources/Swissors/Extensions/UIKit/UITableView+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2016 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UITableView {
Expand Down Expand Up @@ -64,3 +65,5 @@ public extension UITableView {
dequeueHeaderFooter(of: viewType)
}
}

#endif
49 changes: 8 additions & 41 deletions Sources/Swissors/Extensions/UIKit/UIView+Swissors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,20 @@
// Copyright © 2016 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UIView {

// MARK: - Public

static func fullFrameConstraints(for superView: UIView, subview: UIView, with insets: UIEdgeInsets = .zero) -> [NSLayoutConstraint] {
if #available(iOS 9.0, *) {
return [
subview.topAnchor.constraint(equalTo: superView.topAnchor, constant: insets.top),
subview.bottomAnchor.constraint(equalTo: superView.bottomAnchor, constant: -insets.bottom),
subview.leadingAnchor.constraint(equalTo: superView.leadingAnchor, constant: insets.left),
subview.trailingAnchor.constraint(equalTo: superView.trailingAnchor, constant: -insets.right),
]
} else {
return [NSLayoutConstraint(item: subview,
attribute: .top,
relatedBy: .equal,
toItem: superView,
attribute: .top,
multiplier: 1.0,
constant: insets.top),

NSLayoutConstraint(item: subview,
attribute: .left,
relatedBy: .equal,
toItem: superView,
attribute: .left,
multiplier: 1.0,
constant: insets.left),

NSLayoutConstraint(item: subview,
attribute: .bottom,
relatedBy: .equal,
toItem: superView,
attribute: .bottom,
multiplier: 1.0,
constant: -insets.bottom),

NSLayoutConstraint(item: subview,
attribute: .right,
relatedBy: .equal,
toItem: superView,
attribute: .right,
multiplier: 1,
constant: -insets.right),
]
}
return [
subview.topAnchor.constraint(equalTo: superView.topAnchor, constant: insets.top),
subview.bottomAnchor.constraint(equalTo: superView.bottomAnchor, constant: -insets.bottom),
subview.leadingAnchor.constraint(equalTo: superView.leadingAnchor, constant: insets.left),
subview.trailingAnchor.constraint(equalTo: superView.trailingAnchor, constant: -insets.right),
]
}

class func viewFromNib(in bundle: Bundle = Bundle.main, owner: Any? = nil, options: [UINib.OptionsKey: Any]? = nil) -> Self {
Expand Down Expand Up @@ -208,3 +174,4 @@ public extension UIView {
descendants(of: targetClass, avoiding: avoidedViews)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2017 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UIView.AutoresizingMask {
Expand All @@ -29,3 +30,5 @@ public extension UIView.AutoresizingMask {
flexibleSize
}()
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2016 e-Legion. All rights reserved.
//

#if canImport(UIKit)
import UIKit

public extension UIViewController {
Expand Down Expand Up @@ -36,3 +37,5 @@ public extension UIViewController {
removeFromParentViewController()
}
}

#endif
Loading