Skip to content

Releases: NakaokaRei/SwiftAutoGUI

v0.13.0

16 Aug 10:01

Choose a tag to compare

What's New

  • ✨ Add Action pattern for declarative automation sequences
  • 📚 Add Action pattern documentation to README
  • 📚 Add DocC documentation support
  • 🎨 Add Actions demo to sample app
  • 🔧 Improve CI test visibility with xcbeautify and PR comments

Features

The new Action pattern allows you to create reusable automation sequences in a declarative way, making it easier to build complex automation workflows.

Contributors

Thanks to all contributors who made this release possible!

v0.12.0 - Smooth Scrolling with Tweening

26 Jul 09:26
50cf827

Choose a tag to compare

What's Changed

✨ New Features

  • Add smooth scrolling with tweening support (#44)
    • Async methods for animated vertical and horizontal scrolling
    • Support for all existing tweening functions
    • Customizable animation duration and FPS
    • Consistent API with mouse movement animation

📱 Improvements

  • Enhanced sample app with better scrolling demonstrations
  • Improved UI with visual indicators for different scrolling modes

🧪 Testing

  • Added comprehensive tests for smooth scrolling functionality

Usage Example

// Smooth vertical scroll with ease-in-out animation
await SwiftAutoGUI.vscroll(clicks: 100, duration: 2.0, tweening: .easeInOutQuad)

// Horizontal scroll with bounce effect
await SwiftAutoGUI.hscroll(clicks: -50, duration: 1.5, tweening: .easeOutBounce)

// Custom easing function
await SwiftAutoGUI.vscroll(clicks: 100, duration: 2.0, tweening: .custom({ t in
    return t * t * (3 - 2 * t) // Smooth step
}))

Full Changelog: 0.11.0...0.12.0

v0.11.0 - Modern Swift Concurrency Support

20 Jul 00:59

Choose a tag to compare

What's New in v0.11.0

🚀 Modern Swift Concurrency Support

This release brings modern async/await support to SwiftAutoGUI by migrating from blocking Thread.sleep to non-blocking Task.sleep. This makes the library more suitable for use in modern Swift applications and prevents UI freezing in SwiftUI apps.

✨ New Features

Async Keyboard Methods

  • await keyDown(_:) - Async key press events
  • await keyUp(_:) - Async key release events
  • await sendKeyShortcut(_:) - Async keyboard shortcuts

Async Mouse Methods

  • await moveMouse(dx:dy:) - Async relative mouse movement
  • await doubleClick() / await doubleClick(at:button:) - Async double clicks
  • await tripleClick() / await tripleClick(at:button:) - Async triple clicks

⚠️ Deprecations

The following synchronous methods are now deprecated in favor of their async counterparts:

  • keyDown(_:) → Use async version
  • keyUp(_:) → Use async version
  • sendKeyShortcut(_:) → Use async version
  • moveMouse(dx:dy:) → Use async version
  • move(to:) → Use move(to:duration:tweening:fps:) with duration: 0
  • doubleClick() / doubleClick(at:button:) → Use async versions
  • tripleClick() / tripleClick(at:button:) → Use async versions

📚 Documentation Updates

  • Updated README with async/await examples
  • Fixed race conditions in Image Recognition examples
  • Updated Sample app to demonstrate async patterns
  • Migrated all tests to use async methods

🔧 Example Usage

// Modern async/await approach
Task {
    // Type with keyboard
    await SwiftAutoGUI.sendKeyShortcut([.command, .space])
    
    // Move mouse and click
    await SwiftAutoGUI.moveMouse(dx: 100, dy: 100)
    await SwiftAutoGUI.doubleClick()
    
    // Find and click an image
    if let location = SwiftAutoGUI.locateOnScreen("button.png") {
        await SwiftAutoGUI.move(to: CGPoint(x: location.midX, y: location.midY), duration: 0)
        SwiftAutoGUI.leftClick()
    }
}

🙏 Thanks

Thanks to all contributors who helped with this release!

Full Changelog: 0.10.0...0.11.0

SwiftAutoGUI 0.10.0

19 Jul 09:19
0dbf47a

Choose a tag to compare

What's New in 0.10.0

✨ New Features

  • AppleScript Execution Support - Execute AppleScript code directly from Swift
    • executeAppleScript() - Run AppleScript code strings
    • executeAppleScriptFile() - Execute scripts from files
    • Proper error handling and result parsing
    • Support for list results

📚 Documentation

  • Added comprehensive AppleScript documentation and examples
  • Improved API documentation consistency
  • Fixed parameter naming (tween → tweening) throughout

🎯 Demo App

  • New AppleScript tab with interactive script editor
  • 5 pre-built example scripts demonstrating various use cases
  • Real-time execution results display

🔧 Other Changes

  • Added test plan configuration file
  • Updated Xcode project files for AppleScript feature
  • Added comprehensive tests for AppleScript functionality

⚠️ Important Notes

  • AppleScript features require disabling app sandbox or proper entitlements
  • See README for configuration requirements

Release 0.9.0

19 Jul 00:29
21af9e8

Choose a tag to compare

What's New

✨ Mouse Tweening/Animation Support

  • Added TweeningFunction enum with 30+ easing functions (linear, ease-in/out, bounce, elastic, etc.)
  • Added async move() function with duration, tweening, and fps parameters for smooth animated mouse movements
  • Updated Sample app with tweening demonstrations

📚 Documentation

  • Updated DocC topics with comprehensive API categories
  • Modernized Thread.sleep to Task.sleep in README

Example Usage

// Animate mouse movement with easing
await SwiftAutoGUI.move(to: CGPoint(x: 500, y: 500), duration: 2.0, tweening: .easeInOutQuad)

// Custom animation with 60 fps
await SwiftAutoGUI.move(to: targetPoint, duration: 1.5, tweening: .bounceOut, fps: 60)

0.8.0

12 Jul 14:55

Choose a tag to compare

What's Changed

  • feat: Add alert(), confirm(), prompt(), password() dialog functions by @NakaokaRei in #35

Full Changelog: 0.7.0...0.8.0

SwiftAutoGUI 0.7.0

11 Jul 23:20
37067b4

Choose a tag to compare

What's New in 0.7.0

✨ New Features

  • Double-click support - Added doubleClick() and doubleClick(at:button:) methods for double-clicking at current position or specific coordinates
  • Triple-click support - Added tripleClick() and tripleClick(at:button:) methods for triple-clicking (useful for selecting entire lines/paragraphs)
  • Mouse button selection - New MouseButton enum allows specifying left or right mouse button for multi-click operations

📝 API Additions

// Double-click at current position
SwiftAutoGUI.doubleClick()

// Double-click at specific position
SwiftAutoGUI.doubleClick(at: CGPoint(x: 100, y: 200))

// Triple-click with right button
SwiftAutoGUI.tripleClick(button: .right)

// Triple-click at specific position
SwiftAutoGUI.tripleClick(at: CGPoint(x: 150, y: 300))

🔧 Improvements

  • Updated Sample app with new double-click and triple-click demo buttons
  • Uses native macOS CGEvent click count for proper multi-click behavior

📚 Documentation

  • Added comprehensive documentation for all new methods
  • Included usage examples in method documentation

Full Changelog: 0.6.0...0.7.0

What's Changed

  • feat: refactor Sample app to 2-layer architecture by @NakaokaRei in #33
  • feat: Add doubleClick() and tripleClick() functions by @NakaokaRei in #34

Full Changelog: 0.6.0...0.7.0

SwiftAutoGUI 0.6.0

08 Jul 08:17
fbd5fb7

Choose a tag to compare

What's New in 0.6.0

✨ New Features

  • write() function: Type text strings programmatically (#12)
  • position() function: Get current mouse coordinates (#24)
  • Async/await support: Modernized write() method implementation

💥 Breaking Changes

  • Dropped CocoaPods support: Please use Swift Package Manager instead (#29)
  • Minimum macOS version raised to 13.0: Required for async/await features

🎯 Sample App Improvements

  • Added text typing demo showcasing the new write() function
  • Enhanced demo interface with async/await patterns

📚 Documentation

  • Improved API documentation for DocC
  • Updated README with migration guide from CocoaPods to SPM

Migration Guide

From CocoaPods to Swift Package Manager

If you were using CocoaPods:

# Remove from Podfile
pod 'SwiftAutoGUI'

Switch to Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/NakaokaRei/SwiftAutoGUI.git", branch: "master")
]

New API Usage

// Type text
SwiftAutoGUI.write("Hello, World\!")

// Get mouse position
let (x, y) = SwiftAutoGUI.position()
print("Mouse at: \(x), \(y)")

Installation

Swift Package Manager

Add this to your Package.swift:

dependencies: [
    .package(url: "https://github.com/NakaokaRei/SwiftAutoGUI.git", from: "0.6.0")
]

Requirements

  • macOS 13.0+
  • Swift 5.5+
  • Accessibility permissions

Full Changelog: 0.5.0...0.6.0

SwiftAutoGUI 0.5.0

06 Jul 05:28
ab0b88d

Choose a tag to compare

What's New in 0.5.0

This release introduces powerful image recognition capabilities to SwiftAutoGUI, similar to PyAutoGUI's functionality.

✨ Major Features

Image Recognition with OpenCV

  • locateOnScreen() - Find an image on the screen and return its position as CGRect
  • locateCenterOnScreen() - Find an image and return its center point as CGPoint
  • locateAllOnScreen() - Find all instances of an image on the screen with non-maximum suppression

🚀 Enhancements

  • Full support for Retina displays with proper coordinate scaling
  • Confidence threshold parameter for flexible image matching (0.0-1.0)
  • Region-based search for improved performance
  • Comprehensive unit tests using Swift Testing framework
  • Updated sample app demonstrating all image recognition features
  • Fixed documentation generation to work with OpenCV dependency

📖 Example Usage

// Find and click a button
if let buttonCenter = SwiftAutoGUI.locateCenterOnScreen("button.png") {
    SwiftAutoGUI.move(to: buttonCenter)
    SwiftAutoGUI.leftClick()
}

// Find all instances with confidence threshold
let icons = SwiftAutoGUI.locateAllOnScreen("icon.png", confidence: 0.85)
for icon in icons {
    print("Found icon at: \(icon)")
}

🛠️ Technical Details

  • Uses OpenCV's template matching algorithm (TM_CCOEFF_NORMED)
  • Implements non-maximum suppression to avoid duplicate detections
  • Properly handles macOS coordinate system conversions

📦 Installation

Update your Package.swift:

.package(url: "https://github.com/NakaokaRei/SwiftAutoGUI", from: "0.5.0")

Or update your Podfile:

pod 'SwiftAutoGUI', '~> 0.5.0'

🙏 Acknowledgments

Thanks to all contributors who helped make this release possible!

v0.4.0 - Screenshot Support & Testing Framework

06 Jul 01:27

Choose a tag to compare

🎉 What's New in v0.4.0

🖼️ Screenshot Functionality

  • Full screen capture - Take screenshots of the entire screen
  • Region capture - Capture specific areas with screenshot(region:)
  • File saving - Save screenshots directly to files in multiple formats (PNG, JPEG, GIF, BMP, TIFF)
  • Pixel color detection - Get color information at specific coordinates with pixel(x:y:)
  • Screen size detection - Get display dimensions with size()

🧪 Comprehensive Unit Tests

  • Migrated from XCTest to Swift Testing framework
  • Added comprehensive test coverage for:
    • Keyboard functionality (key mappings, events)
    • Mouse operations (movement, clicks, scrolling)
    • Screenshot features
  • CI-friendly tests that handle permission issues gracefully

🔧 Infrastructure Improvements

  • GitHub Actions updates - Fixed deprecated action versions
  • Build CI workflow - Added automated build and test on PRs
  • macOS 15 & Xcode 16 support - Updated CI runners to latest versions
  • Xcode schemes - Added shared schemes for better Xcode integration

🐛 Bug Fixes

  • Fixed sample app file saving in sandbox environment
  • Changed save location from Desktop to Documents folder
  • Added proper error handling for CI environments
  • Disabled code signing for sample app in CI

📦 Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/NakaokaRei/SwiftAutoGUI", from: "0.4.0")
]

CocoaPods

pod 'SwiftAutoGUI', '~> 0.4.0'

📖 Documentation

Check out the documentation for detailed usage examples.

🙏 Contributors

Thanks to everyone who contributed to this release!


Full Changelog: 0.3.1...0.4.0