Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler): Xcode 13 beta compiler issues #179

Merged
merged 12 commits into from
Sep 8, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public extension SingleIndexSearchConnector {

init<HC: HitsController>(searcher: SingleIndexSearcher,
searchController: UISearchController,
hitsInteractor: HitsInteractor<Record> = .init(),
hitsInteractor: HitsInteractor<Record>,
hitsController: HC,
filterState: FilterState? = nil) where HC.DataSource == HitsInteractor<Record> {
let queryInputInteractor = QueryInputInteractor()
Expand All @@ -42,7 +42,7 @@ public extension SingleIndexSearchConnector {
apiKey: APIKey,
indexName: IndexName,
searchController: UISearchController,
hitsInteractor: HitsInteractor<Record> = .init(),
hitsInteractor: HitsInteractor<Record>,
hitsController: HC,
filterState: FilterState? = nil) where HC.DataSource == HitsInteractor<Record> {
let searcher = SingleIndexSearcher(appID: appID,
Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearch/SwiftUI/SearchBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public struct SearchBar: View {
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
public extension View {
func hideKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
// UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public struct SingleIndexSearchConnector<Record: Codable>: Connection {
public init<HC: HitsController, QI: QueryInputController>(searcher: SingleIndexSearcher,
queryInputInteractor: QueryInputInteractor = .init(),
queryInputController: QI,
hitsInteractor: HitsInteractor<Record> = .init(),
hitsInteractor: HitsInteractor<Record>,
hitsController: HC,
filterState: FilterState? = nil) where HC.DataSource == HitsInteractor<Record> {
hitsConnector = .init(searcher: searcher, interactor: hitsInteractor, filterState: filterState)
Expand Down Expand Up @@ -88,7 +88,7 @@ public struct SingleIndexSearchConnector<Record: Codable>: Connection {
indexName: IndexName,
queryInputInteractor: QueryInputInteractor = .init(),
queryInputController: QI,
hitsInteractor: HitsInteractor<Record> = .init(),
hitsInteractor: HitsInteractor<Record>,
hitsController: HC,
filterState: FilterState? = nil) where HC.DataSource == HitsInteractor<Record> {
let searcher = SingleIndexSearcher(appID: appID,
Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Common/Item/ItemController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol ItemController: class {
public protocol ItemController: AnyObject {

associatedtype Item

Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Common/Number/Boundable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol Boundable: class {
public protocol Boundable: AnyObject {
associatedtype Number: Comparable & DoubleRepresentable

func applyBounds(bounds: ClosedRange<Number>?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol SelectableListController: class, Reloadable {
public protocol SelectableListController: AnyObject, Reloadable {

associatedtype Item

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol SelectableSegmentController: class {
public protocol SelectableSegmentController: AnyObject {

associatedtype SegmentKey: Hashable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol ItemListController: class {
public protocol ItemListController: AnyObject {

associatedtype Item: Hashable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol FilterClearController: class {
public protocol FilterClearController: AnyObject {

var onClick: (() -> Void)? { get set }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

protocol FiltersContainer: class {
protocol FiltersContainer: AnyObject {
var filters: FilterState.Storage { get set }
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Hits/AnyHitsInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AlgoliaSearchClient
to create a collections of hits interactors with different record types.
*/

public protocol AnyHitsInteractor: class {
public protocol AnyHitsInteractor: AnyObject {

var onError: Observer<Swift.Error> { get }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public extension HitsConnector {
- externalReload: Defines if controller will be updated automatically by the events or manually
*/
convenience init<Controller: HitsController>(searcher: SingleIndexSearcher,
interactor: HitsInteractor<Hit> = .init(),
interactor: HitsInteractor<Hit>,
filterState: FilterState? = .none,
controller: Controller,
externalReload: Bool = false) where Controller.DataSource == HitsInteractor<Hit> {
self.init(searcher: searcher,
interactor: interactor,
filterState: filterState,
connectSearcher: interactor.connectSearcher,
connectSearcher: { interactor.connectSearcher($0) },
controller: controller,
externalReload: externalReload)
}
Expand Down Expand Up @@ -56,7 +56,7 @@ public extension HitsConnector {
self.init(searcher: searcher,
interactor: interactor,
filterState: filterState,
connectSearcher: interactor.connectSearcher,
connectSearcher: { interactor.connectSearcher($0) },
controller: controller,
externalReload: externalReload)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Hits/GeoHitsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol GeoHitsController: class, Reloadable {
public protocol GeoHitsController: AnyObject, Reloadable {

associatedtype DataSource: HitsSource where DataSource.Record: Geolocated

Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Hits/HitsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol HitsController: class, Reloadable {
public protocol HitsController: AnyObject, Reloadable {

associatedtype DataSource: HitsSource

Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Hits/HitsSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol HitsSource: class {
public protocol HitsSource: AnyObject {

associatedtype Record: Codable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

protocol InfiniteScrollable: class {
protocol InfiniteScrollable: AnyObject {

var lastPageIndex: Int? { get set }
var pageLoader: PageLoadable? { get set }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol MultiIndexHitsController: class, Reloadable {
public protocol MultiIndexHitsController: AnyObject, Reloadable {

var hitsSource: MultiIndexHitsSource? { get set }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol MultiIndexHitsSource: class {
public protocol MultiIndexHitsSource: AnyObject {

func numberOfSections() -> Int
func numberOfHits(inSection section: Int) -> Int
Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Pagination/PageLoadable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol PageLoadable: class {
public protocol PageLoadable: AnyObject {

func loadPage(atIndex pageIndex: Int)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol QueryInputController: class {
public protocol QueryInputController: AnyObject {
var onQueryChanged: ((String?) -> Void)? { get set }
var onQuerySubmitted: ((String?) -> Void)? { get set }
func setQuery(_ query: String?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol DisjunctiveFacetingDelegate: class, FilterGroupsConvertible {
public protocol DisjunctiveFacetingDelegate: AnyObject, FilterGroupsConvertible {

var disjunctiveFacetsAttributes: Set<Attribute> { get }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public protocol HierarchicalFacetingDelegate: class {
public protocol HierarchicalFacetingDelegate: AnyObject {
var hierarchicalAttributes: [Attribute] { get set }
var hierarchicalFilters: [Filter.Facet] { get set }
}
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Searcher/Searcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import AlgoliaSearchClient

/// Protocol describing an entity capable to perform search requests
public protocol Searcher: class {
public protocol Searcher: AnyObject {

/// Current query string
var query: String? { get set }
Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Sequencer/Sequencer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protocol Sequencable {
func cancelPendingOperations()
}

protocol SequencerDelegate: class {
protocol SequencerDelegate: AnyObject {
func didChangeOperationsState(hasPendingOperations: Bool)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

public protocol SwitchIndexController: class {
public protocol SwitchIndexController: AnyObject {

/// Closure to trigger when an index selected
var select: (IndexName) -> Void { get set }
Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Tracker/InsightsTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
import InstantSearchInsights
#endif

public protocol InsightsTracker: class {
public protocol InsightsTracker: AnyObject {

init(eventName: EventName, searcher: TrackableSearcher, insights: Insights)

Expand Down
2 changes: 1 addition & 1 deletion Sources/InstantSearchCore/Tracker/TrackableSearcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

protocol QueryIDContainer: class {
protocol QueryIDContainer: AnyObject {
var queryID: QueryID? { get set }
}

Expand Down
5 changes: 3 additions & 2 deletions Sources/InstantSearchInsights/Logic/EventProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import AlgoliaSearchClient
/// - Storing of the events in the persistent storage (if provided)
/// - Forming the bounded packages of the events
/// – Synchronizing the events with a provided Service
class EventProcessor<Event, Service: EventsService, PackageStorage: Storage>: Flushable where Service.Event == Event,
PackageStorage.Item == [Package<Event>] {
class EventProcessor<Service: EventsService, PackageStorage: Storage>: Flushable where PackageStorage.Item == [Package<Service.Event>] {

public typealias Event = Service.Event

/// The service to sync the events with
let service: Service

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import AlgoliaSearchClient

protocol EventProcessable: class {
protocol EventProcessable: AnyObject {

var isActive: Bool { get set }
func process(_ event: InsightsEvent)
Expand Down
10 changes: 5 additions & 5 deletions Tests/InstantSearchTests/Snippets/HitsSnippets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class HitsSnippets {
let filterState: FilterState = .init()
let hitsTableViewController = CustomHitsTableViewController()
let hitsConnector = HitsConnector<CustomHitModel>(appID: "YourApplicationID",
apiKey: "YourSearchOnlyAPIKey",
indexName: "YourIndexName",
filterState: filterState,
controller: hitsTableViewController)
apiKey: "YourSearchOnlyAPIKey",
indexName: "YourIndexName",
filterState: filterState,
controller: hitsTableViewController)



hitsConnector.searcher.search()
}

Expand Down