Swiftpack.co - colealanroberts/OpenAlpha as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by colealanroberts.
colealanroberts/OpenAlpha 0.1.3
A Swift package for retrieving images from Sony digital cameras
โญ๏ธ 106
๐Ÿ•“ 6 days ago
iOS macOS
.package(url: "https://github.com/colealanroberts/OpenAlpha.git", from: "0.1.3")


A Swift package for retrieving images from Sony digital cameras.


  • iOS 14.0+
  • macOS 10.15+

Quick Start


To install OpenAlpha using Swift Package Manager, add the following dependency to your Package.swift file:

.Package(url: "https://github.com/colealanroberts/OpenAlpha/OpenAlpha.git", majorVersion: 1)

Alternatively, you can add OpenAlpha to your project by clicking the "+" button in Xcode's "Swift Packages" menu.

Required Entitlements

The following entitlements must be added to your Xcode targetโ€”

  • Access Wi-Fi Information
  • Access Hotspot Configuration

Connecting to a Camera

import OpenAlpha

let oa = OpenAlpha()
let hotspot = OpenAlpha.Hotspot(ssid: "DIRECT-SSID:ILCE-7M2", passphrase: "1234abcd")

do {
    let ip = try await oa.connect(to: hotspot)
    // Specific sizes can be requested using: `[.thumbnail, .small, .large, .original]`.
    // Additionally, a static helper method `.all()` has been included, 
    // though one should note the potential battery cost.
    let media = try await oa.media(sizes: .all(), from: ip)
    print(media) // [Media]
} catch {

๐Ÿ”‹ Note: Specifying .all() may incur an additional cost if a Asset.original resource is available for retrieval. Generally speaking, this data represents the original high-resolution photo, and may be much larger in both resolution and file size than even .large. This asset may take longer to retrieve, resulting in additional drain of the camera's battery.

Working with Hotspots and QR Codes

You can also create a Hotspot object by passing a String value, which is useful if you have retrieved a hotspot configuration from a QR code. For information on how to scan and process QR codes, see this tutorial.

Internally, this initializer makes use of Scanner and attempts to construct a valid Hotspot object from the String value.

Accessing Media and Assets

Media objects contain three Asset properties: small, large, thumbnail, and optionally original if supported by the camera. Each Asset object has a single data property, which is a NSData/Data object representing a JPEG image. You can use this data to create a UIImage/NSImage or similar object:

let image = UIImage(data: media[0].large.data)
imageView.image = image


Contributions to OpenAlpha are welcomed!

If you would like to report a bug, discuss the current state of the code, submit a fix, or propose a new feature, please use GitHub's Issues and Pull Request features.

Compatible Cameras

The following camera models have been confirmed to be compatible with OpenAlpha:

Note This is not a complete list, please open a PR with the compatible camera model once confirmed. See the Confirming Compatibility Wiki entry.


OpenAlpha is licensed under the MIT License. See LICENSE for more information.


Cole Roberts


Stars: 106
Last commit: 4 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

6 days ago

A7-M3 Support

In an effort to support the A7-M3 (and hopefully additional models), I've added rudimentary handling for an unmarked res item which is mapped to Asset.original.


Now, to fetch available sizes, a consumer might call:

openAlpha.media(sizes: [.small, .large], from: "")

And to request all sizes:

openAlpha.media(sizes: .all(), from: "")

Note: It's worth noting that .all() may incur an additional cost if an Asset.original URL is requested. Generally speaking, this data may represent the original high-resolution photo, and may be much larger in both resolution and file size than even .large.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics