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

Работаю с AFNetworking напрямую из swift #1

Open
DanSkeel opened this issue Jun 28, 2014 · 0 comments
Open

Работаю с AFNetworking напрямую из swift #1

DanSkeel opened this issue Jun 28, 2014 · 0 comments
Labels

Comments

@DanSkeel
Copy link

Когда добавляешь obj файлы в swift проект, xcode предлагает создать специальный header для использования objective-c классов. (http://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift)
Все методы автоматически подхватываются в автозаполнении.
Пример:

        var manager:AFHTTPRequestOperationManager = AFHTTPRequestOperationManager()
        manager.responseSerializer = AFCompoundResponseSerializer()
        manager.GET("http://google.com", parameters: nil,
            success:{request, response in
                    var datastring = NSString(data: response as NSData, encoding: NSUTF8StringEncoding)
                    println("success\(datastring)")
            },
            failure:{request, error in
                println("error\(error)")
            })

могу закоммитить.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant