Skip to content

Comments

Fix macOS Sonoma compatibility - Swift 5 migration and Location Services#13

Open
smorrel1 wants to merge 1 commit intolg:masterfrom
smorrel1:swift5-macos-sonoma-fix
Open

Fix macOS Sonoma compatibility - Swift 5 migration and Location Services#13
smorrel1 wants to merge 1 commit intolg:masterfrom
smorrel1:swift5-macos-sonoma-fix

Conversation

@smorrel1
Copy link

@smorrel1 smorrel1 commented Feb 7, 2026

Summary

This PR fixes HowOnline for modern macOS versions (10.15+, including Sonoma 14.x) by:

  • Swift 5 Migration: Complete migration from Swift 2 to Swift 5 syntax
  • Location Services Integration: Added CoreLocation to request permission for SSID access (required since macOS 10.15)
  • Removed external dependencies: Replaced CocoaAsyncSocket with native CFStream-based port testing
  • Updated entitlements and Info.plist with location permission descriptions

Problem

Since macOS 10.15 Catalina, Apple requires Location Services permission to access WiFi SSID information via CoreWLAN. Without this permission, CWInterface.ssid() returns nil, causing the app to show "no ssid" even when connected to WiFi.

Changes

File Changes
AppDelegate.swift Added CoreLocation integration, location permission request, Swift 5 syntax
Prober.swift Swift 5 syntax, improved error messages
Pinger.swift Swift 5 syntax, updated SimplePing delegate methods
PortTester.swift Replaced CocoaAsyncSocket with native CFStream
Utilities.swift Swift 5 syntax for pointer handling
Info.plist Added NSLocationWhenInUseUsageDescription
HowOnline.entitlements Added location entitlement
Podfile Updated to macOS 10.15, removed unused pods

Test Plan

  • Build with Xcode 14+ on macOS Sonoma
  • Grant location permission when prompted
  • Verify SSID detection works
  • Verify ping to google.com displays correctly
  • Test various WiFi states (connected, disconnected, no IP)

Fixes #11
Fixes #12

🤖 Generated with Claude Code

This PR addresses issues lg#11 and lg#12 by:

1. **Swift 5 Migration**: Updated all Swift files from Swift 2 to Swift 5 syntax
   - Updated closure syntax and completion handlers
   - Replaced deprecated APIs (NSTimer → Timer, dispatch_async → DispatchQueue)
   - Updated string handling and collection iteration patterns
   - Fixed delegate method signatures

2. **macOS Sonoma (14.x) Compatibility**: Added Location Services support
   - Since macOS 10.15, accessing WiFi SSID requires Location permission
   - Added CoreLocation framework integration in AppDelegate
   - Added NSLocationWhenInUseUsageDescription to Info.plist
   - Added location entitlement to HowOnline.entitlements
   - Updated error message to mention Location permission when SSID unavailable

3. **Removed CocoaAsyncSocket dependency**: Replaced with native CFStream-based
   port testing to reduce external dependencies

4. **Updated deployment target** to macOS 10.15 (Catalina) minimum

Fixes lg#11
Fixes lg#12

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doesn't work on MacOS 14 Sonoma Can't open this project or build it with Xcode 11

1 participant