Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Nov 11, 2024
1 parent 05a5d83 commit 93712c8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

#if canImport(EventKit)
@preconcurrency import EventKit
@preconcurrency import EventKit
#endif
import Factory
import OversizeCalendarService
Expand All @@ -14,13 +14,12 @@ import OversizeModels
import SwiftUI

#if !os(tvOS)
public enum CreateEventType: Equatable, @unchecked Sendable {
public enum CreateEventType: Equatable, @unchecked Sendable {
case new(Date?, calendar: EKCalendar?)
case update(EKEvent)
}


public class CreateEventViewModel: ObservableObject, @unchecked Sendable {
public class CreateEventViewModel: ObservableObject, @unchecked Sendable {
@Injected(\.calendarService) private var calendarService: CalendarService
@Injected(\.locationService) private var locationService: LocationServiceProtocol

Expand Down
25 changes: 12 additions & 13 deletions Sources/OversizeContactsKit/AttendeesList/AttendeesViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

#if canImport(Contacts) && canImport(EventKit)
@preconcurrency import Contacts
@preconcurrency import Contacts
import EventKit
#endif
import Factory
Expand All @@ -29,18 +29,17 @@ import SwiftUI
func fetchData() async {
state = .loading
let _ = await contactsService.requestAccess()

let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey]
let result = await contactsService.fetchContacts(keysToFetch: keys as [CNKeyDescriptor])
switch result {
case let .success(data):
log("✅ CNContact fetched")
state = .result(data)
case let .failure(error):
log("❌ CNContact not fetched (\(error.title))")
state = .error(error)
}


let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey]
let result = await contactsService.fetchContacts(keysToFetch: keys as [CNKeyDescriptor])
switch result {
case let .success(data):
log("✅ CNContact fetched")
state = .result(data)
case let .failure(error):
log("❌ CNContact not fetched (\(error.title))")
state = .error(error)
}
}

func getContactFromEmail(email: String, contacts: [CNContact]) -> CNContact? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

#if canImport(Contacts)
@preconcurrency import Contacts
@preconcurrency import Contacts
#endif
import Factory
import OversizeContactsService
Expand All @@ -25,17 +25,16 @@ import SwiftUI
state = .loading
let _ = await contactsService.requestAccess()

let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey]
let result = await contactsService.fetchContacts(keysToFetch: keys as [CNKeyDescriptor])
switch result {
case let .success(data):
log("✅ CNContact fetched")
state = .result(data)
case let .failure(error):
log("❌ CNContact not fetched (\(error.title))")
state = .error(error)
}

let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey]
let result = await contactsService.fetchContacts(keysToFetch: keys as [CNKeyDescriptor])
switch result {
case let .success(data):
log("✅ CNContact fetched")
state = .result(data)
case let .failure(error):
log("❌ CNContact not fetched (\(error.title))")
state = .error(error)
}
}

func getContactFromEmail(email: String, contacts: [CNContact]) -> CNContact? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

#if canImport(Contacts)
@preconcurrency import Contacts
@preconcurrency import Contacts
#endif
import Factory
import OversizeContactsService
Expand All @@ -27,17 +27,17 @@ import SwiftUI
switch status {
case .success:

let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey]
let result = await contactsService.fetchContacts(keysToFetch: keys as [CNKeyDescriptor])
switch result {
case let .success(data):
log("✅ CNContact fetched")
state = .result(data)
case let .failure(error):
log("❌ CNContact not fetched (\(error.title))")
state = .error(error)
}
let keys = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey]
let result = await contactsService.fetchContacts(keysToFetch: keys as [CNKeyDescriptor])
switch result {
case let .success(data):
log("✅ CNContact fetched")
state = .result(data)
case let .failure(error):
log("❌ CNContact not fetched (\(error.title))")
state = .error(error)
}

case let .failure(error):
state = .error(error)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SwiftUI

#if !os(watchOS)
@MainActor
class AddressPickerViewModel: NSObject, ObservableObject {
class AddressPickerViewModel: NSObject, ObservableObject {
@Injected(\.locationService) var locationService: LocationServiceProtocol

@Published var locationResults: [MKLocalSearchCompletion] = .init()
Expand Down Expand Up @@ -60,7 +60,7 @@ class AddressPickerViewModel: NSObject, ObservableObject {
}
}

extension AddressPickerViewModel: @preconcurrency MKLocalSearchCompleterDelegate {
extension AddressPickerViewModel: @preconcurrency MKLocalSearchCompleterDelegate {
func completerDidUpdateResults(_ completer: MKLocalSearchCompleter) {
currentPromise?(.success(completer.results))
}
Expand Down

0 comments on commit 93712c8

Please sign in to comment.