-
Notifications
You must be signed in to change notification settings - Fork 11
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
How to integrate this library with swift using cocoapods #5
Comments
Sorry to hear you are experiencing problems. We managed to do this and it was actually pretty straight. Just follow these steps:
#import <LSThreadPoolLib/LSThreadPoolLib.h>
import UIKit
class ViewController: UIViewController, LSURLDispatchDelegate {
var _pool : LSThreadPool = LSThreadPool(name: "TestPool", size: 1)
override func viewDidLoad() {
super.viewDidLoad()
_pool.scheduleInvocationForBlock { () -> Void in
let url = NSURL(string: "http://push.lightstreamer.com/lightstreamer/create_session.txt?LS_user=&LS_adapter_set=DEMO&LS_ios_version=1.0")
let req = NSURLRequest(URL: url!)
LSURLDispatcher.sharedDispatcher().dispatchShortRequest(req, delegate: self)
dispatch_async(dispatch_get_main_queue(), {
let alert = UIAlertView(
title: "Alert",
message: "Opening session now...",
delegate: nil,
cancelButtonTitle: "Ok")
alert.show()
})
}
}
func dispatchOperation(operation: LSURLDispatchOperation, didReceiveResponse: NSURLResponse) {
NSLog("Response: \(didReceiveResponse)")
}
func dispatchOperation(operation: LSURLDispatchOperation, didReceiveData: NSData) {
NSLog("Data: \(didReceiveData)")
}
func dispatchOperation(operation: LSURLDispatchOperation, didFailWithError: NSError) {
NSLog("Error: \(didFailWithError)")
}
func dispatchOperationDidFinish(operation: LSURLDispatchOperation) {
NSLog("Finish")
}
} Hope this helps. |
Could we anticipate you'd rewrite an implementation in Swift entirely? |
At the moment we are not investing time on this library, since it has reached its objectives and there are no open issues. But should we decide to rewrite our iOS/OS X/tvOS clients to Swift, it would be surely part of the rewrite. |
I have been trying all the documented ways to import objective-c code into swift and I keep getting errors.
Have you guys managed to do this?
The text was updated successfully, but these errors were encountered: