A comprehensive collection of service modules for Apple platforms that provides easy-to-use interfaces for system frameworks including HealthKit, StoreKit, Core Location, EventKit, Contacts, UserNotifications, and File Management with iCloud support.
- π₯ Health Services - HealthKit integration for health data management
- π Store Services - StoreKit integration for in-app purchases and App Store reviews
- π Location Services - Core Location wrapper for GPS and geocoding
- π Calendar Services - EventKit integration for calendar and event management
- π₯ Contacts Services - Contacts framework integration
- π Notification Services - Local notifications management
- π File Manager Services - File operations with iCloud Documents support
- π Translation Services - Apple Translation framework integration for text translation
- π§ Intelligence Services - Apple Intelligence framework integration (iOS 26.0+)
- π Dependency Injection - Factory-based service registration and injection
- π Multi-platform - Support for iOS, macOS, tvOS, and watchOS
- iOS 15.0+
- macOS 12.0+
- tvOS 15.0+
- watchOS 9.0+
- Swift 6.0+
- Xcode 16.4+
Add OversizeServices to your project using Swift Package Manager:
- In Xcode, select "File" β "Add Package Dependencies"
- Enter the repository URL:
https://github.com/oversizedev/OversizeServices.git - Choose the version you want to use
Or add it to your Package.swift file:
dependencies: [
.package(url: "https://github.com/oversizedev/OversizeServices.git", .upToNextMajor(from: "1.19.0"))
]Then import the specific services you need:
import OversizeServices
import OversizeHealthService
import OversizeStoreService
import OversizeLocationService
import OversizeCalendarService
import OversizeContactsService
import OversizeNotificationService
import OversizeFileManagerServiceProvides HealthKit integration for health data management.
Features:
- Blood pressure monitoring and recording
- Body mass index tracking
- Heart rate data management
- HealthKit authorization handling
Usage Example:
import OversizeHealthService
import FactoryKit
// Inject the service
@Injected(\.bodyMassService) var bodyMassService: BodyMassServiceProtocol
@Injected(\.bloodPressureService) var bloodPressureService: BloodPressureService
// Save blood pressure data
let result = await bloodPressureService.saveBloodPressure(
systolic: 120,
diastolic: 80,
heartRate: 75,
date: Date(),
syncId: UUID(),
syncVersion: 1
)
// Fetch blood pressure history
let historyResult = await bloodPressureService.fetchBloodPressure(
startDate: Calendar.current.date(byAdding: .month, value: -1, to: Date()) ?? Date(),
endDate: Date()
)StoreKit integration for in-app purchases and App Store functionality.
Features:
- Product catalog management
- Purchase handling
- Subscription management
- App Store review requests
- Transaction verification
Usage Example:
import OversizeStoreService
import FactoryKit
// Inject the services
@Injected(\.storeKitService) var storeKitService: StoreKitService
@Injected(\.appStoreReviewService) var reviewService: AppStoreReviewService
// Request products
let productIds = ["com.example.premium", "com.example.subscription"]
let result = await storeKitService.requestProducts(productIds: productIds)
switch result {
case .success(let products):
// Handle products
print("Found \(products.nonConsumable.count) non-consumable products")
case .failure(let error):
// Handle error
print("Failed to fetch products: \(error)")
}
// Request App Store review
reviewService.requestReview()Core Location services wrapper for GPS and geocoding functionality.
Features:
- Current location retrieval
- Authorization management
- Address geocoding
- Reverse geocoding
- Location permission handling
Usage Example:
import OversizeLocationService
import FactoryKit
// Inject the service
@Injected(\.locationService) var locationService: LocationServiceProtocol
// Get current location
do {
if let coordinate = try await locationService.currentLocation() {
print("Current location: \(coordinate.latitude), \(coordinate.longitude)")
// Get address from coordinates
let address = try await locationService.fetchAddressFromLocation(coordinate)
print("Address: \(address.formattedAddress)")
}
} catch {
print("Location error: \(error)")
}
// Check permissions
let permissionResult = locationService.permissionsStatus()
switch permissionResult {
case .success(let hasPermission):
print("Location permission granted: \(hasPermission)")
case .failure(let error):
print("Permission error: \(error)")
}EventKit integration for calendar and event management.
Features:
- Event creation and modification
- Calendar access management
- Recurring events support
- Event reminders and alarms
- Calendar source management
Usage Example:
import OversizeCalendarService
let calendarService = CalendarService()
// Create a new event
let result = await calendarService.createEvent(
title: "Team Meeting",
notes: "Weekly team sync",
startDate: Date(),
endDate: Date().addingTimeInterval(3600), // 1 hour later
isAllDay: false,
location: "Conference Room A",
alarms: [.fiveMinutes, .fifteenMinutes],
recurrenceRules: .weekly
)
switch result {
case .success(let eventCreated):
print("Event created successfully: \(eventCreated)")
case .failure(let error):
print("Failed to create event: \(error)")
}
// Fetch calendars
let calendarsResult = await calendarService.fetchCalendars()Contacts framework integration for contact management.
Features:
- Contact fetching and enumeration
- Contact access authorization
- Contact data retrieval with custom keys
- Contact sorting and filtering
Usage Example:
import OversizeContactsService
import FactoryKit
// Inject the service
@Injected(\.contactsService) var contactsService: ContactsService
// Request access to contacts
let accessResult = await contactsService.requestAccess()
switch accessResult {
case .success:
// Fetch all contacts
let contactsResult = await contactsService.fetchContacts()
switch contactsResult {
case .success(let contacts):
print("Found \(contacts.count) contacts")
for contact in contacts {
print("Contact: \(contact.givenName) \(contact.familyName)")
}
case .failure(let error):
print("Failed to fetch contacts: \(error)")
}
case .failure(let error):
print("Access denied: \(error)")
}Local notifications management with UserNotifications framework.
Features:
- Local notification scheduling
- Notification authorization
- Pending notifications management
- Custom notification content
- Time-based and location-based triggers
Usage Example:
import OversizeNotificationService
import FactoryKit
// Inject the service
@Injected(\.localNotificationService) var notificationService: LocalNotificationServiceProtocol
// Request notification permissions
let accessResult = await notificationService.requestAccess()
switch accessResult {
case .success:
// Schedule a notification
await notificationService.scheduleNotification(
id: UUID(),
title: "Reminder",
body: "Don't forget your appointment",
timeInterval: 3600, // 1 hour from now
repeatNotification: false,
scheduleType: .time,
dateComponents: DateComponents()
)
// Check pending notifications
let pendingIds = await notificationService.fetchPendingIds()
print("Pending notifications: \(pendingIds.count)")
case .failure(let error):
print("Notification access denied: \(error)")
}File management with iCloud Documents support.
Features:
- Local document management
- iCloud Documents integration
- File synchronization
- Document picker integration
- Cloud storage availability checking
Usage Example:
import OversizeFileManagerService
import FactoryKit
// Inject the services
@Injected(\.fileManagerService) var fileManager: FileManagerServiceProtocol
@Injected(\.cloudDocumentsService) var cloudService: CloudDocumentsServiceProtocol
@Injected(\.fileManagerSyncService) var syncService: FileManagerSyncServiceProtocol
// Check iCloud availability
let iCloudResult = syncService.isICloudContainerAvailable()
switch iCloudResult {
case .success(let available):
if available {
print("iCloud is available")
// Save document to iCloud
let fileURL = URL(fileURLWithPath: "/path/to/document.pdf")
let saveResult = await syncService.saveDocument(
fileURL: fileURL,
folder: "Documents",
location: .iCloud
)
switch saveResult {
case .success(let savedURL):
print("Document saved to: \(savedURL)")
case .failure(let error):
print("Save failed: \(error)")
}
}
case .failure(let error):
print("iCloud not available: \(error)")
}
// Save document locally
let localURL = URL(fileURLWithPath: "/path/to/local/document.pdf")
let localResult = await fileManager.saveDocument(pickedURL: localURL, folder: "LocalDocs")Apple Translation framework integration for text translation.
Features:
- Single and batch text translation
- Automatic source language detection
- Streaming batch translations
- Pre-loading translation models
- Multi-platform support (iOS 26.0+, macOS 26.0+)
Usage Example:
import OversizeServices
import FactoryKit
// Inject the service
@Injected(\.translationService) var translationService: TranslationServiceProtocol
// Single translation
do {
let translation = try await translationService.translate(
"Hello, world!",
from: .init(languageCode: .english),
to: .init(languageCode: .russian)
)
print("Translation: \(translation)")
} catch {
print("Translation error: \(error)")
}
// Auto-detect source language
let autoTranslation = try await translationService.translate(
"Hello, world!",
from: nil, // auto-detect
to: .init(languageCode: .russian)
)
// Batch translation
let texts = ["Hello", "Goodbye", "Thank you"]
let translations = try await translationService.translate(
texts,
from: .init(languageCode: .english),
to: .init(languageCode: .russian)
)
// Streaming batch translation
let requests = texts.enumerated().map {
(text: $0.element, id: "\($0.offset)")
}
for try await (id, translation) in translationService.translateBatch(
requests,
from: nil,
to: .init(languageCode: .russian)
) {
print("[\(id)] \(translation)")
}
// Pre-load translation model
try await translationService.prepareTranslation(
from: .init(languageCode: .english),
to: .init(languageCode: .russian)
)Platform Requirements:
- Protocol available from iOS 17.4+, macOS 14.4+ (for dependency injection)
- Translation functionality requires iOS 26.0+, macOS 26.0+
- Requires physical device (does not work in Simulator)
- Internet connection needed for initial language model download
Apple Intelligence framework integration (iOS 26.0+, macOS 26.0+).
Features:
- Text summarization
- Writing tools integration
- Privacy-focused on-device processing
Usage Example:
import OversizeServices
import FactoryKit
// Inject the service (iOS 26.0+ only)
@Injected(\.intelligenceService) var intelligenceService: IntelligenceServiceProtocol
// Summarize text
do {
let summary = try await intelligenceService.summarize(
"Long text to summarize...",
type: .brief
)
print("Summary: \(summary)")
} catch {
print("Summarization error: \(error)")
}The main module that provides service registration and dependency injection setup.
Usage Example:
import OversizeServices
import FactoryKit
// Services are automatically registered and can be injected using Factory
@Injected(\.someService) var service: SomeServiceProtocol
// Or resolve manually
let container = Container.shared
let service = container.someService()OversizeServices depends on several other packages from the Oversize ecosystem:
- OversizeCore - Core utilities and extensions
- OversizeModels - Shared data models
- OversizeLocalizable - Localization support
- Factory - Dependency injection container
OversizeServices is released under the MIT license. See LICENSE for details.
Made with β€οΈ by the Oversize