sergdort / CleanArchitectureRxSwift

Example of Clean Architecture of iOS app using RxSwift
MIT License
3.88k stars 494 forks source link

How can I run your demo project on Xcode 10.1 & Swift 4.2 #70

Closed wangdu1005 closed 5 years ago

wangdu1005 commented 5 years ago

Dear Sergdort,

Thanks so much for sharing this good article. But my issue is when I run pod install on Xcode 10.1 & Swift 4.2, and run project. It appear so many error message. Please see the image below:

Screen Shot 2019-05-21 at 9 11 34 AM

First error is the RxAlmofire SWIFT_VERSION is not support Swift 5.0, therefore, I add code in the end of podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'RxAlamofire'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
      end
    end
  end
end

Therefore, the error is solved. But cmd+R appear too many error talking about .h is not found. I try to change the RxSwift version to the 4.5.0, but CocoaPods told me it is not found.

Screen Shot 2019-05-21 at 9 21 42 AM Screen Shot 2019-05-21 at 9 21 57 AM

Below is my current podfile all content:

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
inhibit_all_warnings!

def rx_swift
    pod 'RxSwift', '~> 5.0'
end

def rx_cocoa
    pod 'RxCocoa', '~> 5.0'
end

def test_pods
    pod 'RxTest'
    pod 'RxBlocking'
    pod 'Nimble'
end

target 'CleanArchitectureRxSwift' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_cocoa
  rx_swift
  pod 'QueryKit'
  target 'CleanArchitectureRxSwiftTests' do
    inherit! :search_paths
    test_pods
  end

end

target 'CoreDataPlatform' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_swift
  pod 'QueryKit'
  target 'CoreDataPlatformTests' do
    inherit! :search_paths
    test_pods
  end

end

target 'Domain' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_swift

  target 'DomainTests' do
    inherit! :search_paths
    test_pods
  end

end

target 'NetworkPlatform' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!
    rx_swift
    pod 'Alamofire'
    pod 'RxAlamofire'

    target 'NetworkPlatformTests' do
        inherit! :search_paths
        test_pods
    end

end

target 'RealmPlatform' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_swift
  pod 'RxRealm', '~> 1.0.0'
  pod 'QueryKit'
  pod 'RealmSwift', '~> 3.15'
  pod 'Realm', '~> 3.15'

  target 'RealmPlatformTests' do
    inherit! :search_paths
    test_pods
  end

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'RxAlamofire'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
      end
    end
  end
end

Please give me some advise (solution), thank again!

wangdu1005 commented 5 years ago

I found the solution by fork your project, and checkout the swift 4.2 commit. problem solved! Even though, still have many warning in pods framework. But your demo running properly. Thanks, I close this issue.