Skip to content

Version 4.4.0

Latest

Choose a tag to compare

@RuiNelson RuiNelson released this 24 Oct 23:00

What's New

  • AVFoundation playback - The new SwiftSMBAVFoundation product streams audio and video from an SMB share into AVPlayer, reading only the byte ranges the player asks for. See Playing media with AVFoundation.

    import AVFoundation
    import SwiftSMBAVFoundation
    
    let player = AVPlayer(playerItem: connection.makePlayerItem(at: "Videos/holiday.mp4"))
    player.play()
  • Image metadata - The new SwiftSMBEXIFKit product reads, edits, and removes the EXIF of remote images with EXIFKit, fetching only the byte ranges that hold metadata. Edits by path go through a temporary file that replaces the original only once the new image is complete. See Reading and editing image metadata.

    import SwiftSMBEXIFKit // Re-exports EXIFKit.
    import UIKit
    
    let metadata = try await connection.imageMetadata(at: "Photos/IMG_0001.JPG")
    if let data = try await metadata.readThumbnail(), let thumbnail = UIImage(data: data) {
        imageView.image = thumbnail
    }
  • Forking connections - SMB.Connection.fork() opens another connection to the same share with the same credentials and configuration, so you can run operations in parallel without passing the credentials around again.

  • Positional reads and writes - SMB.File.read(upTo:atOffset:) and SMB.File.write(_:atOffset:) neither use nor move the handle's current offset, so concurrent tasks can read and write different ranges of one handle without coordinating seeks.

  • POSIX error codes - SMB.Error.posixCode reports the POSIX error that matches an SMB error, such as ENOENT for a missing file or EACCES for access denied.

  • Updated requirements - SwiftSMB now requires Swift 6.4 and macOS 11, iOS 14, Mac Catalyst 14, tvOS 14, visionOS 1, or watchOS 7, and declares Android (API 28+) support explicitly, next to Linux.

  • A sample app - SampleApp/SMB+AV is a minimal SwiftUI app that plays media from an SMB share.

Bug Fixes

  • Fixed builds and arithmetic traps on 32-bit watchOS (arm64_32).