ReactiveX / RxSwift

Reactive Programming in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

issue: Initialiser does not override a designated initialiser from its superclass On Xcode 14.3 (arm64)

abhuzz opened this issue · comments

Short description of the issue:

When I tried to run the project at that time these errors occur:
Screenshot 2023-05-03 at 7 21 35 PM
Screenshot 2023-05-03 at 7 21 47 PM

Expected outcome: This supportive RxCocoa should run smoothly without error on arm64.

What actually happens:
Screenshot 2023-05-03 at 7 21 47 PM
https://github.com/abhuzz/RxCocoa_issue/raw/bf5dddb7ba3e209d80ea133d91e68fbe5ebe90e7/error_occurs.mov

Self contained code example that reproduces the issue:

//  RxTableViewReactiveArrayDataSource.swift

class RxTableViewReactiveArrayDataSourceSequenceWrapper<S: Sequence>
    : RxTableViewReactiveArrayDataSource<S.Iterator.Element>
    , RxTableViewDataSourceType {
    typealias Element = S

     override init(cellFactory: @escaping CellFactory) { // Initializer does not override a designated initializer from its superclass
        super.init(cellFactory: cellFactory)
    }

    func tableView(_ tableView: UITableView, observedEvent: Event<S>) {
        Binder(self) { tableViewDataSource, sectionModels in
            let sections = Array(sectionModels)
            tableViewDataSource.tableView(tableView, observedElements: sections)
        }.on(observedEvent)
    }
}

// RxCollectionViewReactiveArrayDataSource.swift

class RxCollectionViewReactiveArrayDataSourceSequenceWrapper<S: Sequence>
    : RxCollectionViewReactiveArrayDataSource<S.Iterator.Element>
    , RxCollectionViewDataSourceType {
    typealias Element = S

    override init(cellFactory: @escaping CellFactory) { // Initializer does not override a designated initializer from its superclass
        super.init(cellFactory: cellFactory)
    }
    
    func collectionView(_ collectionView: UICollectionView, observedEvent: Event<S>) {
        Binder(self) { collectionViewDataSource, sectionModels in
            let sections = Array(sectionModels)
            collectionViewDataSource.collectionView(collectionView, observedElements: sections)
        }.on(observedEvent)
    }
}

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

RxSwift (>= 4.4.2, ~> 4.4) and RxCocoa (4.5.0)

Platform/Environment

  • iOS 16.2 (arm64)
  • macOS
  • tvOS
  • watchOS
  • playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • easy, 100% repro
  • sometimes, 10%-100%
  • hard, 2% - 10%
  • extremely hard, %0 - 2%

Xcode version:

  Xcode Version 14.3

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • yes (which ones)
  • no (only one 14.3)

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • just starting
  • I have a small code base
  • I have a significant code base

https://github.com/abhuzz/RxCocoa_issue/raw/bf5dddb7ba3e209d80ea133d91e68fbe5ebe90e7/error_occurs.mov

Same issue with me. Any solution?

Same issue with me.

commented

Can you confirm if this PR(#2516) fixes the issue?

commented

Oh I reproduced the same error, I think this only happens on older versions(RxCocoa 4.5.0).
Updating to the latest version does not cause the error.

If you want to keep the old version and get rid of the error, you can remove the initializer like I did with the PR I opened.

Hey @abhuzz - we don't provide support for versions older than RxSwift 6.x at this point

RxSwift 4 is over 4 years old at this point.

I suggest forking the specific tag and adding your fixes to it for your use case.
@TTOzzi i appreciate your assistance and research ! 🙏

Thanks, @TTOzzi and @freak4pc for suggesting upgrading the RxSwift version. Hope upgrading to a newer version of RxSwift may be a better long-term solution.