It appears the OSLogStore.entries has been refined for Swift but is not visible.
This should probably be made visible — see https://feedbackassistant.apple.com/feedback/7867104
For reference here's a basic snippet attempting to read the current process' logs:
Gist
This should probably be made visible — see https://feedbackassistant.apple.com/feedback/7867104
For reference here's a basic snippet attempting to read the current process' logs:
Code Block import OSLog class LogReader: ObservableObject { var log: OSLogStore init?() { do { log = try OSLogStore.init(scope: .currentProcessIdentifier) dump(log) /* * Declared in OSLog/Store.h * as - (nullable OSLogEnumerator *)entriesEnumeratorWithOptions:(OSLogEnumeratorOptions)options position:(nullable OSLogPosition *)position predicate:(nullable NSPredicate *)predicate error:(NSError **)error API_AVAILABLE(macos(10.15), ios(14.0), tvos(14.0), watchos(7.0)) NS_REFINED_FOR_SWIFT; * Swift refinement not visible? — use name prefixed with * See https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/improving_objective-c_api_declarations_for_swift */ let enumerator = try log.entriesEnumerator(options: [], position: nil, predicate: nil) dump(enumerator) var next: Any? repeat { next = enumerator.nextObject() dump(next) } while next != nil } catch { dump(error) return nil } } } /* Result: Error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.OSLogService was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.OSLogService was invalidated.} */
Gist