FLYNNLABAboutMeCodingActivityStudy 2024초등수학링크오프너릴리즈노트WordTest
swift - AFNetworking 연동해서 사용하기
2014-09-23
swift, ios

LINK

https://medium.com/@aommiez/afnetwork-integrate-swfit-80514b545b40 https://medium.com/@stigi/swift-cocoapods-da09d8ba6dd2

기존 Objective-C로 된 코드를 연동하기 위해서는 Objective-C Bridging Header 를 설정한다. 이렇게 설정해두고 나면 Xcode에서 자동완성도 지원한다.

let manager = AFHTTPRequestOperationManager()
manager.GET(
  "http://example.com/resources.json",
  parameters: nil,
  success: { (operation: AFHTTPRequestOperation!,
              responseObject: AnyObject!) in
      println("JSON: " + responseObject.description)
  },
  failure: { (operation: AFHTTPRequestOperation!,
              error: NSError!) in
      println("Error: " + error.localizedDescription)
  })