reference from https://www.appcoda.com.tw/playground-driven-development/
- Create Xcode project
- Init Podfile
$ pod init
- Edit Podfile insert below code.
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings.delete('CODE_SIGNING_ALLOWED')
config.build_settings.delete('CODE_SIGNING_REQUIRED')
end
end
-
Close Xcode project
-
install pod for target
$ pod install
- open .xcworkspace/
- create new playground
- Drag playground file from finder into xcworkspace project navigator.
- Add new target Cocoa Touch Framework name "AppFramework"
- Edit Podfile
target 'AppFramework' do
use_frameworks!
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
end
- Setup pod for target AppFramework
$ pod install
- Select AppFramework and iPhone 7 simulator build once (important)
- import AppFramework and pods in playground page
import AppFramework
import RxSwift
import RxCocoa
- Done. We can use class in playground for test! Remember we must rebuild AppFramework target after we modify any class.