From 03a33ce43828d35754f803f00d3701cf4963bfd9 Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Fri, 21 Jul 2023 15:23:28 +0200 Subject: [PATCH] feat(SendableArray): .first property --- Sources/InfomaniakCore/Asynchronous/SendableArray.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/InfomaniakCore/Asynchronous/SendableArray.swift b/Sources/InfomaniakCore/Asynchronous/SendableArray.swift index 49874b7..62eea04 100644 --- a/Sources/InfomaniakCore/Asynchronous/SendableArray.swift +++ b/Sources/InfomaniakCore/Asynchronous/SendableArray.swift @@ -105,6 +105,12 @@ public final class SendableArray: @unchecked Sendable, Sequence { } } + public var first: T? { + lock.sync { + return content.first + } + } + public func makeIterator() -> IndexingIterator<[T]> { lock.sync { return content.makeIterator()