Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ only_rules:
# MARK comment should be in valid format.
- mark

# Modifier order should be consistent.
- modifier_order

# Opening braces should be preceded by a single space and on the same line as
# the declaration.
- opening_brace
Expand Down
2 changes: 1 addition & 1 deletion Modules/Sources/AsyncImageKit/Helpers/FaviconService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UIKit
public actor FaviconService {
public static let shared = FaviconService()

private nonisolated let cache = FaviconCache()
nonisolated private let cache = FaviconCache()

private let session = URLSession(configuration: {
let configuration = URLSessionConfiguration.default
Expand Down
10 changes: 5 additions & 5 deletions Modules/Sources/AsyncImageKit/Helpers/ImageSaliencyService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import Vision
/// Detects the most salient (visually interesting) region in images using Vision framework.
/// Results are cached by image URL.
public actor ImageSaliencyService {
public nonisolated static let shared = ImageSaliencyService()
nonisolated public static let shared = ImageSaliencyService()

private nonisolated let cache = SaliencyCache()
private nonisolated let detector = SaliencyDetector()
nonisolated private let cache = SaliencyCache()
nonisolated private let detector = SaliencyDetector()
private var inflightTasks: [URL: Task<CGRect?, Never>] = [:]

init() {
Expand All @@ -18,7 +18,7 @@ public actor ImageSaliencyService {
}

/// Returns a cached rect synchronously without starting a task, or `nil` if not yet cached.
public nonisolated func cachedSaliencyRect(for url: URL) -> CGRect? {
nonisolated public func cachedSaliencyRect(for url: URL) -> CGRect? {
cache.cachedRect(for: url)
}

Expand Down Expand Up @@ -46,7 +46,7 @@ public actor ImageSaliencyService {
/// Returns the frame for the image view within a container such that `saliencyRect`
/// appears at `topInset` points from the top. Returns `nil` when no adjustment is needed
/// (i.e. the image is not portrait relative to the container).
public nonisolated func adjustedFrame(
nonisolated public func adjustedFrame(
saliencyRect: CGRect,
imageSize: CGSize,
in containerSize: CGSize,
Expand Down
10 changes: 5 additions & 5 deletions Modules/Sources/AsyncImageKit/ImageDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import AVFoundation
/// The system that downloads and caches images, and prepares them for display.
@ImageDownloaderActor
public final class ImageDownloader {
public nonisolated static let shared = ImageDownloader()
nonisolated public static let shared = ImageDownloader()

private nonisolated let cache: MemoryCacheProtocol
nonisolated private let cache: MemoryCacheProtocol

private let urlSession = URLSession {
$0.urlCache = nil
Expand All @@ -23,7 +23,7 @@ public final class ImageDownloader {

private var tasks: [String: ImageDataTask] = [:]

public nonisolated init(
nonisolated public init(
cache: MemoryCacheProtocol = MemoryCache.shared
) {
self.cache = cache
Expand Down Expand Up @@ -112,7 +112,7 @@ public final class ImageDownloader {
cache[makeKey(for: imageURL, size: size)] = image
}

private nonisolated func makeKey(for imageURL: URL?, size: ImageSize?) -> String {
nonisolated private func makeKey(for imageURL: URL?, size: ImageSize?) -> String {
guard let imageURL else {
assertionFailure("The request.url was nil") // This should never happen
return ""
Expand Down Expand Up @@ -150,7 +150,7 @@ public final class ImageDownloader {
return try await task.getData(subscriptionID: subscriptionID)
}

fileprivate nonisolated func unsubscribe(_ subscriptionID: UUID, key: String) {
nonisolated fileprivate func unsubscribe(_ subscriptionID: UUID, key: String) {
Task {
await _unsubscribe(subscriptionID, key: key)
}
Expand Down
8 changes: 4 additions & 4 deletions Modules/Sources/AsyncImageKit/ImagePrefetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public final class ImagePrefetcher {
}
}

public nonisolated init(
nonisolated public init(
downloader: ImageDownloader = .shared,
maxConcurrentTasks: Int = 2
) {
self.downloader = downloader
self.maxConcurrentTasks = maxConcurrentTasks
}

public nonisolated func startPrefetching(for requests: [ImageRequest]) {
nonisolated public func startPrefetching(for requests: [ImageRequest]) {
Task { @ImageDownloaderActor in
for request in requests {
startPrefetching(for: request)
Expand Down Expand Up @@ -67,7 +67,7 @@ public final class ImagePrefetcher {
performPendingTasks()
}

public nonisolated func stopPrefetching(for requests: [ImageRequest]) {
nonisolated public func stopPrefetching(for requests: [ImageRequest]) {
Task { @ImageDownloaderActor in
for request in requests {
stopPrefetching(for: request)
Expand All @@ -83,7 +83,7 @@ public final class ImagePrefetcher {
}
}

public nonisolated func stopAll() {
nonisolated public func stopAll() {
Task { @ImageDownloaderActor in
for (_, value) in queue {
value.task?.cancel()
Expand Down
4 changes: 2 additions & 2 deletions Modules/Sources/AsyncImageKit/Views/AsyncImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public final class AsyncImageView: UIView {
}
}

public override init(frame: CGRect) {
override public init(frame: CGRect) {
super.init(frame: frame)

setupView()
Expand All @@ -94,7 +94,7 @@ public final class AsyncImageView: UIView {
backgroundColor = .secondarySystemBackground
}

public override func layoutSubviews() {
override public func layoutSubviews() {
super.layoutSubviews()

imageView.frame = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class DefaultFormattableContentAction: FormattableContentAction {
}
}

private(set) public var command: FormattableContentActionCommand?
public private(set) var command: FormattableContentActionCommand?

public var identifier: Identifier {
return type(of: self).actionIdentifier()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class FormattableCommentContent: NotificationTextContent {
return isActionOn(id: identifier) || !isActionEnabled(id: identifier)
}

public override var kind: FormattableContentKind {
override public var kind: FormattableContentKind {
return .comment
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

public class FooterTextContent: FormattableTextContent {
public override init(text: String, ranges: [FormattableContentRange], actions: [FormattableContentAction]?) {
override public init(text: String, ranges: [FormattableContentRange], actions: [FormattableContentAction]?) {
if text == "You replied to this comment." {
let localizedText = NSLocalizedString("You replied to this comment.", comment: "Notification text - below a comment notification detail")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

public class FormattableUserContent: NotificationTextContent {
public override var kind: FormattableContentKind {
override public var kind: FormattableContentKind {
return .user
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public class NotificationTextContent: FormattableTextContent, FormattableMediaCo
public let parent: Notifiable
public let meta: [String: AnyObject]?

public override var text: String? {
override public var text: String? {
return textOverride ?? super.text
}

public override var kind: FormattableContentKind {
override public var kind: FormattableContentKind {
if let firstMedia = media.first, firstMedia.kind == .image || firstMedia.kind == .badge {
return .image
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public final class ManageConnectionsHostingController: UIHostingController<AnyVi
)
}

@preconcurrency required dynamic init?(coder: NSCoder) {
@preconcurrency dynamic required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public final class SocialOAuthWebViewController: UIViewController, WKNavigationD
fatalError("init(coder:) has not been implemented")
}

public override func viewDidLoad() {
override public func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .systemBackground
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import WordPressKit
/// NSPersistentContainer subclass that defaults to the shared container directory
///
final class SharedPersistentContainer: NSPersistentContainer {
internal override class func defaultDirectoryURL() -> URL {
override internal class func defaultDirectoryURL() -> URL {
var url = super.defaultDirectoryURL()
if let newURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: BuildSettings.current.appGroupName) {
url = newURL
Expand Down
4 changes: 2 additions & 2 deletions Modules/Sources/WordPressCore/Types/LockingHashMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public class LockingHashMap<Value>: @unchecked Sendable {
public class LockingTaskHashMap<T, E>: LockingHashMap<Task<T, E>>, @unchecked Sendable where T: Sendable, E: Error {

@discardableResult
public override func removeValue(forKey key: AnyHashable) -> Task<T, E>? {
override public func removeValue(forKey key: AnyHashable) -> Task<T, E>? {
lock.withLock {
let task = self.list.removeValue(forKey: key)
task?.cancel()
return task
}
}

public override func removeAll() {
override public func removeAll() {
lock.withLock {
for key in self.list.keys {
let task = self.list.removeValue(forKey: key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum IntelligenceService {
public static let contextSizeLimit = 4096

/// Checks if intelligence features are supported on the current device.
public nonisolated static var isSupported: Bool {
nonisolated public static var isSupported: Bool {
guard #available(iOS 26, *) else {
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension AccountServiceRemoteREST {
/// - email Email from Apple account.
/// - fullName User's full name from Apple account.
/// - Returns: Dictionary with endpoint parameters, to be used when connecting to social service.
static public func appleSignInParameters(email: String, fullName: String) -> [String: AnyObject] {
public static func appleSignInParameters(email: String, fullName: String) -> [String: AnyObject] {
return [
"user_email": email as AnyObject,
"user_name": fullName as AnyObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ open class HTTPAuthenticationAlertController {

private static var onGoingChallenges = [URLProtectionSpace: [AuthenticationHandler]]()

static public func controller(for challenge: URLAuthenticationChallenge, handler: @escaping AuthenticationHandler) -> UIAlertController? {
public static func controller(for challenge: URLAuthenticationChallenge, handler: @escaping AuthenticationHandler) -> UIAlertController? {
if var handlers = onGoingChallenges[challenge.protectionSpace] {
handlers.append(handler)
onGoingChallenges[challenge.protectionSpace] = handlers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Foundation

extension NSMutableParagraphStyle {
@objc convenience public init(minLineHeight: CGFloat, lineBreakMode: NSLineBreakMode, alignment: NSTextAlignment) {
@objc public convenience init(minLineHeight: CGFloat, lineBreakMode: NSLineBreakMode, alignment: NSTextAlignment) {
self.init()
self.minimumLineHeight = minLineHeight
self.lineBreakMode = lineBreakMode
self.alignment = alignment
}

@objc convenience public init(minLineHeight: CGFloat, maxLineHeight: CGFloat, lineBreakMode: NSLineBreakMode, alignment: NSTextAlignment) {
@objc public convenience init(minLineHeight: CGFloat, maxLineHeight: CGFloat, lineBreakMode: NSLineBreakMode, alignment: NSTextAlignment) {
self.init(minLineHeight: minLineHeight, lineBreakMode: lineBreakMode, alignment: alignment)
self.maximumLineHeight = maxLineHeight
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RemoteBlockEditorSettings: Codable {
return String(data: data, encoding: .utf8)
}

required public init(from decoder: Decoder) throws {
public required init(from decoder: Decoder) throws {
let map = try decoder.container(keyedBy: CodingKeys.self)
self.isFSETheme = (try? map.decode(Bool.self, forKey: .isFSETheme)) ?? false
self.galleryWithImageBlocks = (try? map.decode(Bool.self, forKey: .galleryWithImageBlocks)) ?? false
Expand Down
8 changes: 4 additions & 4 deletions Modules/Sources/WordPressKit/WordPressComRestApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ open class WordPressComRestApi: NSObject {

// MARK: WordPressComRestApi

@objc convenience public init(oAuthToken: String? = nil, userAgent: String? = nil) {
@objc public convenience init(oAuthToken: String? = nil, userAgent: String? = nil) {
self.init(oAuthToken: oAuthToken, userAgent: userAgent, backgroundUploads: false, backgroundSessionIdentifier: WordPressComRestApi.defaultBackgroundSessionIdentifier)
}

@objc convenience public init(oAuthToken: String? = nil, userAgent: String? = nil, baseURL: URL = WordPressComRestApi.apiBaseURL) {
@objc public convenience init(oAuthToken: String? = nil, userAgent: String? = nil, baseURL: URL = WordPressComRestApi.apiBaseURL) {
self.init(oAuthToken: oAuthToken, userAgent: userAgent, backgroundUploads: false, backgroundSessionIdentifier: WordPressComRestApi.defaultBackgroundSessionIdentifier, baseURL: baseURL)
}

Expand Down Expand Up @@ -586,13 +586,13 @@ extension WordPressComRestApi {

/// Returns an API object without an OAuth token defined & with the userAgent set for the WordPress App user agent
///
@objc class public func anonymousApi(userAgent: String) -> WordPressComRestApi {
@objc public class func anonymousApi(userAgent: String) -> WordPressComRestApi {
return WordPressComRestApi(oAuthToken: nil, userAgent: userAgent)
}

/// Returns an API object without an OAuth token defined & with both the userAgent & localeKey set for the WordPress App user agent
///
@objc class public func anonymousApi(userAgent: String, localeKey: String) -> WordPressComRestApi {
@objc public class func anonymousApi(userAgent: String, localeKey: String) -> WordPressComRestApi {
return WordPressComRestApi(oAuthToken: nil, userAgent: userAgent, localeKey: localeKey)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Sources/WordPressKit/WordPressOrgXMLRPCApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ open class WordPressOrgXMLRPCApi: NSObject, WordPressOrgXMLRPCApiInterfacing {
/// - Parameters:
/// - endpoint: the endpoint to connect to the xmlrpc api interface.
/// - userAgent: the user agent to use on the connection.
@objc convenience public init(endpoint: URL, userAgent: String? = nil) {
@objc public convenience init(endpoint: URL, userAgent: String? = nil) {
self.init(endpoint: endpoint, userAgent: userAgent, backgroundUploads: false, backgroundSessionIdentifier: WordPressOrgXMLRPCApi.defaultBackgroundSessionIdentifier + "." + endpoint.absoluteString)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private struct CodingKeys {
@objc public class RemoteReaderSiteInfoSubscriptionPost: NSObject {
@objc public var sendPosts: Bool

@objc required public init(dictionary: [String: Any]) {
@objc public required init(dictionary: [String: Any]) {
self.sendPosts = (dictionary[CodingKeys.sendPost] as? Bool) ?? false
super.init()
}
Expand All @@ -22,7 +22,7 @@ private struct CodingKeys {
@objc public var sendComments: Bool
@objc public var postDeliveryFrequency: String

@objc required public init(dictionary: [String: Any]) {
@objc public required init(dictionary: [String: Any]) {
sendComments = (dictionary[CodingKeys.sendComments] as? Bool) ?? false
postDeliveryFrequency = (dictionary[CodingKeys.postDeliveryFrequency] as? String) ?? ""
super.init(dictionary: dictionary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class WebCommentContentRenderer: NSObject, CommentContentRenderer {
private var isReloadNeeded = false

// MARK: Methods
public override init() {
override public init() {
super.init()

webView.isInspectable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class AsyncBlockOperation: AsyncOperation, @unchecked Sendable {
self.block = block
}

public override func main() {
override public func main() {
self.block { [weak self] in
self?.state = .isFinished
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open class AsyncOperation: Operation, @unchecked Sendable {
case isReady, isExecuting, isFinished
}

public override var isAsynchronous: Bool {
override public var isAsynchronous: Bool {
return true
}

Expand All @@ -18,15 +18,15 @@ open class AsyncOperation: Operation, @unchecked Sendable {
}
}

public override var isExecuting: Bool {
override public var isExecuting: Bool {
return state == .isExecuting
}

public override var isFinished: Bool {
override public var isFinished: Bool {
return state == .isFinished
}

public override func start() {
override public func start() {
if isCancelled {
state = .isFinished
return
Expand Down
Loading