Skip to content

Commit

Permalink
Release 24.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robot-divkit committed Apr 4, 2023
1 parent c058068 commit ce51820
Show file tree
Hide file tree
Showing 720 changed files with 1,048 additions and 2,168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseUI
import BaseUIPublic

/// Determines postioning of child item inside parent container
@frozen
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,25 @@ extension Array {
return dict
}

public func find<T>(_ transform: (Element) -> T?) -> T? {
for item in self {
if let r = transform(item) {
return r
}
}
return nil
}

public func findAll<T>(_ transform: (Element) -> T?) -> [T] {
var result = [T]()
forEach {
if let found = transform($0) {
result += found
}
}
return result
}

@inlinable
public var randomElement: Element? {
guard !isEmpty else { return nil }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Copyright 2022 Yandex LLC. All rights reserved.

@_exported import BaseTiny
@_exported import BaseTinyPublic
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseUI
import BaseUIPublic

extension EdgeInsets: YCEdgeInsets {
public typealias Domain = CGFloat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CoreGraphics
import Foundation

import BaseUI
import BaseUIPublic

extension EdgeInsets {
public func insetHeight(_ height: CGFloat) -> CGFloat {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseUI
import BaseUIPublic

@frozen
public enum Gradient: Equatable {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2019 Yandex LLC. All rights reserved.

import BaseUI
import BaseUIPublic

public enum ImagePlaceholder: Equatable, CustomDebugStringConvertible {
case image(Image)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public final class TimerScheduler: Scheduling {
extension Timer: TimerType {}

extension Timer {
@_spi(Base)
public static func make(
withTimeInterval ti: TimeInterval,
handler: @escaping () -> Void,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseUI
import BaseUIPublic

public struct RelativePoint: Equatable {
public var rawValue: CGPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseUI
import BaseUIPublic

public struct RelativeRect: Hashable {
public var origin: RelativePoint
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseUI
import BaseUIPublic

#if os(iOS)
import UIKit.UIScrollView
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Foundation

import BaseUI
import BaseUIPublic

extension String {
public enum PaddingSide {
Expand Down Expand Up @@ -40,7 +40,7 @@ extension String {
enumerateSubstrings(
in: wholeStringRange,
options: .byWords
) { _, _wordRange, _enclosingRange, stop in
) { _, _wordRange, _enclosingRange, stop -> Void in
let caretAtTheBeginningOfWord = _wordRange.lowerBound == caretPos
let caretInsideWord = _wordRange.contains(caretPos)
let caretAtTheEndOfWord = _wordRange.upperBound == caretPos
Expand All @@ -60,7 +60,7 @@ extension String {

public func allWordRanges() -> [Range<Index>] {
var wordRanges: [Range<Index>] = []
enumerateSubstrings(in: wholeStringRange, options: .byWords) { _, range, _, _ in
enumerateSubstrings(in: wholeStringRange, options: .byWords) { _, range, _, _ -> Void in
wordRanges.append(range)
}
return wordRanges
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ public struct WeakCollection<T> {

public mutating func append(_ object: T) {
assert((object as AnyObject) is T)
array = array.filter { $0.value != nil }
compact()
array.append(Weak(value: object as AnyObject))
}

public mutating func append(_ objects: [T]) {
compact()
for object in objects {
assert((object as AnyObject) is T)
array.append(Weak(value: object as AnyObject))
}
}

public mutating func remove(_ object: T) {
guard let objectIndex = array.firstIndex(where: { $0.value === (object as AnyObject) })
else { return }
Expand All @@ -46,6 +54,10 @@ public struct WeakCollection<T> {
public mutating func removeAll() {
array.removeAll()
}

public mutating func compact() {
array = array.filter { $0.value != nil }
}
}

extension WeakCollection: CustomStringConvertible {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseTiny
import BaseTinyPublic

@_implementationOnly import CoreImage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseTiny
import BaseTinyPublic

extension CGContext {
public func inSeparateGState(_ block: Action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CoreGraphics
import Foundation

import BaseTiny
import BaseTinyPublic

extension CGFloat {
public func rounded(toStep step: CGFloat = 1) -> CGFloat {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CoreGraphics
import Foundation

import BaseTiny
import BaseTinyPublic

extension CGRect {
public func inset(by value: CGFloat) -> CGRect {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CoreGraphics
import Foundation

import BaseTiny
import BaseTinyPublic

extension CGSize: Hashable {
public static var infinite: CGSize {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CoreGraphics
import Foundation

import BaseTiny
import BaseTinyPublic

extension EdgeInsets {
public var contentOrigin: CGPoint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CoreGraphics
import CoreText
import Foundation

import BaseTiny
import BaseTinyPublic

extension Font {
public class func with(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseTiny
import BaseTinyPublic

public protocol FontSpecifying: AnyObject {
func font(weight: FontWeight, size: CGFloat) -> Font
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import CoreGraphics
import Foundation

import BaseTiny
import BaseTinyPublic

extension Image {
public var orientationTransform: CGAffineTransform {
Expand Down
2 changes: 1 addition & 1 deletion Core/BaseUI/Label.swift → Core/BaseUIPublic/Label.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import UIKit

import BaseTiny
import BaseTinyPublic

@objc(YCLabel)
public final class Label: UIView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import AppKit
#endif

import BaseTiny
import BaseTinyPublic

extension NSAttributedString {
public enum VerticalPosition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import CoreGraphics

import BaseTiny
import BaseTinyPublic

public var fontSpecifiers = FontSpecifiers(
text: systemFontSpecifier,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import Foundation

import BaseTiny
import BaseTinyPublic

extension String {
public func with(typo: Typo) -> NSAttributedString {
Expand Down
2 changes: 1 addition & 1 deletion Core/BaseUI/Typo.swift → Core/BaseUIPublic/Typo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CoreGraphics
import CoreText
import Foundation

import BaseTiny
import BaseTinyPublic

private let DKParagraphStyleAttributeName = NSAttributedString.Key("DKParagraphStyle")
private let DKAllowHeightOverrunAttributeName = NSAttributedString.Key("DKAllowHeightOverrun")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation
import UIKit

import BaseTiny
import BaseTinyPublic

extension UIImage {
private static func delayForImage(at index: Int, source: CGImageSource) -> Double {
Expand Down Expand Up @@ -82,7 +82,7 @@ extension UIImage {
extension Array where Element == Int {
fileprivate var gcd: Int {
guard !isEmpty else { return 0 }
return reduce(0) { BaseUI.gcd($0, $1) }
return reduce(0) { BaseUIPublic.gcd($0, $1) }
}
}

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions Core/CommonCore/ImageViewBackgroundModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extension Optional where Wrapped == ImageViewBackgroundModel {
view.subviews.filter { $0 == oldValue?.view }.forEach { $0.removeFromSuperview() }
view.backgroundColor = self?.color
if let backgroundView = self?.view {
backgroundView.frame = view.bounds
backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(backgroundView)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Copyright 2021 Yandex LLC. All rights reserved.

@_exported import Base
@_exported import BasePublic
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Foundation

import BaseUI
import BaseUIPublic

public final class HTMLParser {
private let resolver = HTMLEntitiesResolver()
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Foundation

import BaseUI
import BaseUIPublic

struct HTMLTaggedString: CustomStringConvertible {
let text: String
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2022 Yandex LLC. All rights reserved.

import BaseUI
import BaseUIPublic

public struct ImageRedrawingStyle: Equatable {
public static func ==(lhs: ImageRedrawingStyle, rhs: ImageRedrawingStyle) -> Bool {
Expand Down
Loading

0 comments on commit ce51820

Please sign in to comment.