diff --git a/Thrift-swift3.podspec b/Thrift-swift3.podspec
deleted file mode 100644
index 126c00b..0000000
--- a/Thrift-swift3.podspec
+++ /dev/null
@@ -1,16 +0,0 @@
-Pod::Spec.new do |s|
-  s.name          = "Thrift-swift3"
-  s.version       = "1.0.0"
-  s.summary       = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
-  s.description   = <<-DESC
-The Apache Thrift scalable cross-language software framework for networked services development combines a software stack with a code generation engine to build services that work efficiently and seamlessly between many programming languages.
-                    DESC
-  s.homepage      = "http://thrift.apache.org"
-  s.license       = { :type => 'Apache License, Version 2.0', :url => 'https://www.apache.org/licenses/LICENSE-2.0' }
-  s.author        = { "Apache Thrift Developers" => "dev@thrift.apache.org" }
-  s.ios.deployment_target = '9.0'
-  s.osx.deployment_target = '10.10'
-  s.requires_arc  = true
-  s.source        = { :git => "https://github.com/apache/thrift.git", :tag => "v1.0.0" }
-  s.source_files  = "lib/swift/Sources/*.swift"
-end
diff --git a/Thrift.podspec b/Thrift.podspec
index a406eec..126c00b 100644
--- a/Thrift.podspec
+++ b/Thrift.podspec
@@ -1,5 +1,5 @@
 Pod::Spec.new do |s|
-  s.name          = "Thrift"
+  s.name          = "Thrift-swift3"
   s.version       = "1.0.0"
   s.summary       = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
   s.description   = <<-DESC
@@ -8,11 +8,9 @@
   s.homepage      = "http://thrift.apache.org"
   s.license       = { :type => 'Apache License, Version 2.0', :url => 'https://www.apache.org/licenses/LICENSE-2.0' }
   s.author        = { "Apache Thrift Developers" => "dev@thrift.apache.org" }
+  s.ios.deployment_target = '9.0'
+  s.osx.deployment_target = '10.10'
   s.requires_arc  = true
-  s.ios.deployment_target = '7.0'
-  s.osx.deployment_target = '10.8'
-  s.ios.framework = 'CFNetwork'
-  s.osx.framework = 'CoreServices'
   s.source        = { :git => "https://github.com/apache/thrift.git", :tag => "v1.0.0" }
-  s.source_files  = 'lib/cocoa/src/**/*.{h,m,swift}'
+  s.source_files  = "lib/swift/Sources/*.swift"
 end
diff --git a/build/docker/README.md b/build/docker/README.md
index 966d690..d00f87d 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -174,7 +174,6 @@
 | C# (mono) | 4.2.1.0       | 4.6.2.7       |       |
 | c_glib    | 2.48.2        | 2.56.0        |       |
 | cl (sbcl) |               | 1.4.15        |       |
-| cocoa     |               |               | Not in CI |
 | d         | 2.075.1       | 2.083.1       |       |
 | dart      | 1.22.1        | 1.24.3        |       |
 | delphi    |               |               | Not in CI |
diff --git a/build/veralign.sh b/build/veralign.sh
index 4ed7c51..c54de53 100755
--- a/build/veralign.sh
+++ b/build/veralign.sh
@@ -50,13 +50,12 @@
 # These files can be updated automatically:
 FILES[ApacheThrift.nuspec]=simpleReplace
 FILES[CMakeLists.txt]=simpleReplace
-FILES[Thrift-swift3.podspec]=simpleReplace
 FILES[Thrift.podspec]=simpleReplace
 FILES[appveyor.yml]=simpleReplace
 FILES[bower.json]=jsonReplace
 FILES[configure.ac]=configureReplace
 FILES[contrib/thrift.spec]=simpleReplace
-FILES[lib/cocoa/src/Thrift.h]=simpleReplace
+FILES[doc/specs/idl.md]=simpleReplace
 FILES[lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs]=simpleReplace
 FILES[lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj]=simpleReplace
 FILES[lib/csharp/src/Properties/AssemblyInfo.cs]=simpleReplace
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 96efe65..372cbab 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -74,7 +74,6 @@
 THRIFT_ADD_COMPILER(as3     "Enable compiler for ActionScript 3" ON)
 THRIFT_ADD_COMPILER(c_glib  "Enable compiler for C with Glib" ON)
 THRIFT_ADD_COMPILER(cl      "Enable compiler for Common LISP" ON)
-THRIFT_ADD_COMPILER(cocoa   "Enable compiler for Cocoa Objective-C" ON)
 THRIFT_ADD_COMPILER(cpp     "Enable compiler for C++" ON)
 THRIFT_ADD_COMPILER(csharp  "Enable compiler for C#" ON)
 THRIFT_ADD_COMPILER(d       "Enable compiler for D" ON)
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 0b8ef2e..087f6bd 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -79,38 +79,37 @@
                  src/thrift/audit/t_audit.h
 
 # Specific client generator source
-thrift_SOURCES += src/thrift/generate/t_c_glib_generator.cc \
+thrift_SOURCES += src/thrift/generate/t_as3_generator.cc \
+                  src/thrift/generate/t_c_glib_generator.cc \
+                  src/thrift/generate/t_cl_generator.cc \
                   src/thrift/generate/t_cpp_generator.cc \
-                  src/thrift/generate/t_java_generator.cc \
-                  src/thrift/generate/t_json_generator.cc \
-                  src/thrift/generate/t_as3_generator.cc \
-                  src/thrift/generate/t_dart_generator.cc \
-                  src/thrift/generate/t_haxe_generator.cc \
                   src/thrift/generate/t_csharp_generator.cc \
-                  src/thrift/generate/t_netcore_generator.cc \
-                  src/thrift/generate/t_netcore_generator.h \
-                  src/thrift/generate/t_py_generator.cc \
-                  src/thrift/generate/t_rb_generator.cc \
-                  src/thrift/generate/t_perl_generator.cc \
-                  src/thrift/generate/t_php_generator.cc \
-                  src/thrift/generate/t_erl_generator.cc \
-                  src/thrift/generate/t_cocoa_generator.cc \
-                  src/thrift/generate/t_swift_generator.cc \
-                  src/thrift/generate/t_st_generator.cc \
-                  src/thrift/generate/t_ocaml_generator.cc \
-                  src/thrift/generate/t_hs_generator.cc \
-                  src/thrift/generate/t_xsd_generator.cc \
-                  src/thrift/generate/t_xml_generator.cc \
-                  src/thrift/generate/t_html_generator.cc \
-                  src/thrift/generate/t_js_generator.cc \
-                  src/thrift/generate/t_javame_generator.cc \
+                  src/thrift/generate/t_d_generator.cc \
+                  src/thrift/generate/t_dart_generator.cc \
                   src/thrift/generate/t_delphi_generator.cc \
+                  src/thrift/generate/t_erl_generator.cc \
                   src/thrift/generate/t_go_generator.cc \
                   src/thrift/generate/t_gv_generator.cc \
-                  src/thrift/generate/t_d_generator.cc \
+                  src/thrift/generate/t_haxe_generator.cc \
+                  src/thrift/generate/t_hs_generator.cc \
+                  src/thrift/generate/t_html_generator.cc \
+                  src/thrift/generate/t_java_generator.cc \
+                  src/thrift/generate/t_javame_generator.cc \
+                  src/thrift/generate/t_js_generator.cc \
+                  src/thrift/generate/t_json_generator.cc \
                   src/thrift/generate/t_lua_generator.cc \
+                  src/thrift/generate/t_netcore_generator.cc \
+                  src/thrift/generate/t_netcore_generator.h \
+                  src/thrift/generate/t_ocaml_generator.cc \
+                  src/thrift/generate/t_perl_generator.cc \
+                  src/thrift/generate/t_php_generator.cc \
+                  src/thrift/generate/t_py_generator.cc \
+                  src/thrift/generate/t_rb_generator.cc \
                   src/thrift/generate/t_rs_generator.cc \
-                  src/thrift/generate/t_cl_generator.cc
+                  src/thrift/generate/t_st_generator.cc \
+                  src/thrift/generate/t_swift_generator.cc \
+                  src/thrift/generate/t_xml_generator.cc \
+                  src/thrift/generate/t_xsd_generator.cc
 
 thrift_CPPFLAGS = -I$(srcdir)/src
 thrift_CXXFLAGS = -Wall -Wextra -pedantic -Werror
diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj
index 0628b54..3b59728 100644
--- a/compiler/cpp/compiler.vcxproj
+++ b/compiler/cpp/compiler.vcxproj
@@ -54,11 +54,10 @@
     <ClCompile Include="src\thrift\audit\t_audit.cpp" />
     <ClCompile Include="src\thrift\common.cc" />
     <ClCompile Include="src\thrift\generate\t_as3_generator.cc" />
-    <ClCompile Include="src\thrift\generate\t_cocoa_generator.cc" />
+    <ClCompile Include="src\thrift\generate\t_c_glib_generator.cc" />
+    <ClCompile Include="src\thrift\generate\t_cl_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_cpp_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_csharp_generator.cc" />
-    <ClCompile Include="src\thrift\generate\t_netcore_generator.cc" />
-    <ClCompile Include="src\thrift\generate\t_c_glib_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_d_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_dart_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_delphi_generator.cc" />
@@ -69,11 +68,12 @@
     <ClCompile Include="src\thrift\generate\t_haxe_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_hs_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_html_generator.cc" />
-    <ClCompile Include="src\thrift\generate\t_javame_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_java_generator.cc" />
+    <ClCompile Include="src\thrift\generate\t_javame_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_js_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_json_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_lua_generator.cc" />
+    <ClCompile Include="src\thrift\generate\t_netcore_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_ocaml_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_perl_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_php_generator.cc" />
@@ -247,4 +247,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc b/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
deleted file mode 100644
index ac644f5..0000000
--- a/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
+++ /dev/null
@@ -1,3309 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <string>
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sstream>
-#include "thrift/platform.h"
-#include "thrift/generate/t_oop_generator.h"
-
-using std::map;
-using std::ostream;
-using std::ofstream;
-using std::ostringstream;
-using std::string;
-using std::stringstream;
-using std::vector;
-
-static const string endl = "\n"; // avoid ostream << std::endl flushes
-
-/**
- * Objective-C code generator.
- *
- * mostly copy/pasting/tweaking from mcslee's work.
- */
-class t_cocoa_generator : public t_oop_generator {
-public:
-  t_cocoa_generator(t_program* program,
-                    const std::map<std::string, std::string>& parsed_options,
-                    const std::string& option_string)
-    : t_oop_generator(program) {
-    (void)option_string;
-    std::map<std::string, std::string>::const_iterator iter;
-
-    log_unexpected_ = false;
-    validate_required_ = false;
-    async_clients_ = false;
-    promise_kit_ = false;
-    debug_descriptions_ = false;
-    pods_ = false;
-    for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
-      if( iter->first.compare("log_unexpected") == 0) {
-        log_unexpected_ = true;
-      } else if( iter->first.compare("validate_required") == 0) {
-        validate_required_ = true;
-      } else if( iter->first.compare("async_clients") == 0) {
-        async_clients_ = true;
-      } else if( iter->first.compare("promise_kit") == 0) {
-        promise_kit_ = true;
-      } else if( iter->first.compare("debug_descriptions") == 0) {
-        debug_descriptions_ = true;
-      } else if( iter->first.compare("pods") == 0) {
-        pods_ = true;
-      } else {
-        throw "unknown option cocoa:" + iter->first;
-      }
-    }
-
-    out_dir_base_ = "gen-cocoa";
-  }
-
-  /**
-   * Init and close methods
-   */
-
-  void init_generator();
-  void close_generator();
-
-  void generate_consts(std::vector<t_const*> consts);
-
-  /**
-   * Program-level generation functions
-   */
-
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
-
-  void print_const_value(ostream& out,
-                         string name,
-                         t_type* type,
-                         t_const_value* value,
-                         bool defval = false);
-  std::string render_const_value(ostream& out,
-                                 t_type* type,
-                                 t_const_value* value,
-                                 bool box_it = false);
-
-  void generate_cocoa_struct(t_struct* tstruct, bool is_exception);
-  void generate_cocoa_struct_interface(std::ostream& out,
-                                       t_struct* tstruct,
-                                       bool is_xception = false);
-  void generate_cocoa_struct_implementation(std::ostream& out,
-                                            t_struct* tstruct,
-                                            bool is_xception = false,
-                                            bool is_result = false);
-  void generate_cocoa_struct_initializer_signature(std::ostream& out, t_struct* tstruct);
-  void generate_cocoa_struct_init_with_coder_method(ostream& out,
-                                                    t_struct* tstruct,
-                                                    bool is_exception);
-  void generate_cocoa_struct_encode_with_coder_method(ostream& out,
-                                                      t_struct* tstruct,
-                                                      bool is_exception);
-  void generate_cocoa_struct_copy_method(ostream& out,
-                                         t_struct* tstruct,
-                                         bool is_exception);
-  void generate_cocoa_struct_hash_method(ostream& out, t_struct* tstruct);
-  void generate_cocoa_struct_is_equal_method(ostream& out,
-                                             t_struct* tstruct,
-                                             bool is_exception);
-  void generate_cocoa_struct_field_accessor_implementations(std::ostream& out,
-                                                            t_struct* tstruct,
-                                                            bool is_exception);
-  void generate_cocoa_struct_reader(std::ostream& out, t_struct* tstruct);
-  void generate_cocoa_struct_result_writer(std::ostream& out, t_struct* tstruct);
-  void generate_cocoa_struct_writer(std::ostream& out, t_struct* tstruct);
-  void generate_cocoa_struct_validator(std::ostream& out, t_struct* tstruct);
-  void generate_cocoa_struct_description(std::ostream& out, t_struct* tstruct);
-
-  std::string function_result_helper_struct_type(t_service *tservice, t_function* tfunction);
-  std::string function_args_helper_struct_type(t_service* tservice, t_function* tfunction);
-  void generate_function_helpers(t_service *tservice, t_function* tfunction);
-
-  /**
-   * Service-level generation functions
-   */
-
-  void generate_cocoa_service_protocol(std::ostream& out, t_service* tservice);
-  void generate_cocoa_service_async_protocol(std::ostream& out, t_service* tservice);
-
-  void generate_cocoa_service_client_interface(std::ostream& out, t_service* tservice);
-  void generate_cocoa_service_client_async_interface(std::ostream& out, t_service* tservice);
-
-  void generate_cocoa_service_client_send_function_implementation(ostream& out,
-                                                                  t_service* tservice,
-                                                                  t_function* tfunction,
-                                                                  bool needs_protocol);
-  void generate_cocoa_service_client_send_function_invocation(ostream& out, t_function* tfunction);
-  void generate_cocoa_service_client_send_async_function_invocation(ostream& out,
-                                                                    t_function* tfunction,
-                                                                    string failureBlockName);
-  void generate_cocoa_service_client_recv_function_implementation(ostream& out,
-                                                                  t_service* tservice,
-                                                                  t_function* tfunction,
-                                                                  bool needs_protocol);
-  void generate_cocoa_service_client_implementation(std::ostream& out, t_service* tservice);
-  void generate_cocoa_service_client_async_implementation(std::ostream& out, t_service* tservice);
-
-  void generate_cocoa_service_server_interface(std::ostream& out, t_service* tservice);
-  void generate_cocoa_service_server_implementation(std::ostream& out, t_service* tservice);
-  void generate_cocoa_service_helpers(t_service* tservice);
-  void generate_service_client(t_service* tservice);
-  void generate_service_server(t_service* tservice);
-  void generate_process_function(t_service* tservice, t_function* tfunction);
-
-  /**
-   * Serialization constructs
-   */
-
-  void generate_deserialize_field(std::ostream& out, t_field* tfield, std::string fieldName);
-
-  void generate_deserialize_struct(std::ostream& out, t_struct* tstruct, std::string prefix = "");
-
-  void generate_deserialize_container(std::ostream& out, t_type* ttype, std::string prefix = "");
-
-  void generate_deserialize_set_element(std::ostream& out, t_set* tset, std::string prefix = "");
-
-  void generate_deserialize_map_element(std::ostream& out, t_map* tmap, std::string prefix = "");
-
-  void generate_deserialize_list_element(std::ostream& out,
-                                         t_list* tlist,
-                                         std::string prefix = "");
-
-  void generate_serialize_field(std::ostream& out, t_field* tfield, std::string prefix = "");
-
-  void generate_serialize_struct(std::ostream& out, t_struct* tstruct, std::string fieldName = "");
-
-  void generate_serialize_container(std::ostream& out, t_type* ttype, std::string prefix = "");
-
-  void generate_serialize_map_element(std::ostream& out,
-                                      t_map* tmap,
-                                      std::string iter,
-                                      std::string map);
-
-  void generate_serialize_set_element(std::ostream& out, t_set* tmap, std::string iter);
-
-  void generate_serialize_list_element(std::ostream& out,
-                                       t_list* tlist,
-                                       std::string index,
-                                       std::string listName);
-
-  /**
-   * Helper rendering functions
-   */
-
-  std::string cocoa_prefix();
-  std::string cocoa_imports();
-  std::string cocoa_thrift_imports();
-  std::string type_name(t_type* ttype, bool class_ref = false, bool needs_mutable = false);
-  std::string element_type_name(t_type* ttype);
-  std::string base_type_name(t_base_type* tbase);
-  std::string declare_property(t_field* tfield);
-  std::string declare_property_isset(t_field* tfield);
-  std::string declare_property_unset(t_field* tfield);
-  std::string invalid_return_statement(t_function* tfunction);
-  std::string function_signature(t_function* tfunction, bool include_error);
-  std::string async_function_signature(t_function* tfunction, bool include_error);
-  std::string promise_function_signature(t_function* tfunction);
-  std::string argument_list(t_struct* tstruct, string protocol_name, bool include_error);
-  std::string type_to_enum(t_type* ttype);
-  std::string format_string_for_type(t_type* type);
-  std::string format_cast_for_type(t_type* type);
-  std::string call_field_setter(t_field* tfield, std::string fieldName);
-  std::string box(t_type *ttype, std::string field_name);
-  std::string unbox(t_type* ttype, std::string field_name);
-  std::string getter_name(string field_name);
-  std::string setter_name(string field_name);
-
-  bool type_can_be_copy(t_type* ttype) {
-    ttype = get_true_type(ttype);
-    
-    return ttype->is_string();
-  }
-  
-  bool type_can_be_null(t_type* ttype) {
-    ttype = get_true_type(ttype);
-
-    return ttype->is_container() || ttype->is_struct() || ttype->is_xception()
-           || ttype->is_string();
-  }
-
-private:
-  std::string cocoa_prefix_;
-  std::string constants_declarations_;
-  int error_constant_;
-
-  /**
-   * File streams
-   */
-
-  ofstream_with_content_based_conditional_update f_header_;
-  ofstream_with_content_based_conditional_update f_impl_;
-
-  bool log_unexpected_;
-  bool validate_required_;
-  bool async_clients_;
-  bool promise_kit_;
-  bool debug_descriptions_;
-  bool pods_;
-};
-
-/**
- * Prepares for file generation by opening up the necessary file output
- * streams.
- */
-void t_cocoa_generator::init_generator() {
-  // Make output directory
-  MKDIR(get_out_dir().c_str());
-  cocoa_prefix_ = program_->get_namespace("cocoa");
-
-  // we have a .h header file...
-  string f_header_name = cocoa_prefix_ + capitalize(program_name_) + ".h";
-  string f_header_fullname = get_out_dir() + f_header_name;
-  f_header_.open(f_header_fullname.c_str());
-
-  f_header_ << autogen_comment() << endl;
-
-  f_header_ << cocoa_imports() << cocoa_thrift_imports();
-
-  // ...and a .m implementation file
-  string f_impl_name = cocoa_prefix_ + capitalize(program_name_) + ".m";
-  string f_impl_fullname = get_out_dir() + f_impl_name;
-  f_impl_.open(f_impl_fullname.c_str());
-
-  f_impl_ << autogen_comment() << endl;
-
-  f_impl_ << cocoa_imports() << cocoa_thrift_imports() << "#import \"" << f_header_name << "\""
-          << endl << endl;
-
-  error_constant_ = 60000;
-}
-
-/**
- * Prints standard Cocoa imports
- *
- * @return List of imports for Cocoa libraries
- */
-string t_cocoa_generator::cocoa_imports() {
-  return string() + "#import <Foundation/Foundation.h>\n" + "\n";
-}
-
-/**
- * Prints thrift runtime imports
- *
- * @return List of imports necessary for thrift runtime
- */
-string t_cocoa_generator::cocoa_thrift_imports() {
-
-  vector<string> includes_list;
-  includes_list.push_back("TProtocol.h");
-  includes_list.push_back("TProtocolFactory.h");
-  includes_list.push_back("TApplicationError.h");
-  includes_list.push_back("TProtocolError.h");
-  includes_list.push_back("TProtocolUtil.h");
-  includes_list.push_back("TProcessor.h");
-  includes_list.push_back("TBase.h");
-  includes_list.push_back("TAsyncTransport.h");
-  includes_list.push_back("TBaseClient.h");
-
-  std::ostringstream includes;
-
-  vector<string>::const_iterator i_iter;
-  for (i_iter=includes_list.begin(); i_iter!=includes_list.end(); ++i_iter) {
-    includes << "#import ";
-    if (pods_) {
-      includes << "<Thrift/" << *i_iter << ">";
-    } else {
-      includes << "\"" << *i_iter << "\"";
-    }
-    includes << endl;
-  }
-
-  includes << endl;
-
-  if (promise_kit_) {
-    includes << "#import ";
-    if (pods_) {
-      includes << "<PromiseKit/PromiseKit.h>";
-    } else {
-      includes << "\"PromiseKit.h\"";
-    }
-    includes << endl;
-  }
-
-  // Include other Thrift includes
-  const vector<t_program*>& other_includes = program_->get_includes();
-  for (size_t i = 0; i < other_includes.size(); ++i) {
-    includes << "#import \""
-             << other_includes[i]->get_namespace("cocoa")
-             << capitalize(other_includes[i]->get_name())
-             << ".h\"" << endl;
-  }
-
-  includes << endl;
-
-  return includes.str();
-}
-
-/**
- * Finish up generation.
- */
-void t_cocoa_generator::close_generator() {
-  // stick our constants declarations at the end of the header file
-  // since they refer to things we are defining.
-  f_header_ << constants_declarations_ << endl;
-}
-
-/**
- * Generates a typedef. This is just a simple 1-liner in objective-c
- *
- * @param ttypedef The type definition
- */
-void t_cocoa_generator::generate_typedef(t_typedef* ttypedef) {
-  if (ttypedef->get_type()->is_map()) {
-    t_map *map = (t_map *)ttypedef->get_type();
-    if (map->get_key_type()->is_struct()) {
-      f_header_ << indent() << "@class " << type_name(map->get_key_type(), true) << ";" << endl;
-    }
-    if (map->get_val_type()->is_struct()) {
-      f_header_ << indent() << "@class " << type_name(map->get_val_type(), true) << ";" << endl;
-    }
-  }
-  else if (ttypedef->get_type()->is_set()) {
-    t_set *set = (t_set *)ttypedef->get_type();
-    if (set->get_elem_type()->is_struct()) {
-      f_header_ << indent() << "@class " << type_name(set->get_elem_type(), true) << ";" << endl;
-    }
-  }
-  else if (ttypedef->get_type()->is_list()) {
-    t_list *list = (t_list *)ttypedef->get_type();
-    if (list->get_elem_type()->is_struct()) {
-      f_header_ << indent() << "@class " << type_name(list->get_elem_type(), true) << ";" << endl;
-    }
-  }
-  f_header_ << indent() << "typedef " << type_name(ttypedef->get_type()) << " " << cocoa_prefix_
-            << ttypedef->get_symbolic() << ";" << endl << endl;
-  if (ttypedef->get_type()->is_container()) {
-    f_header_ << indent() << "typedef " << type_name(ttypedef->get_type(), false, true) << " " << cocoa_prefix_
-              << "Mutable" << ttypedef->get_symbolic() << ";" << endl << endl;
-  }
-}
-
-/**
- * Generates code for an enumerated type. In Objective-C, this is
- * essentially the same as the thrift definition itself, instead using
- * NS_ENUM keyword in Objective-C.  For namespace purposes, the name of
- * the enum is prefixed to each element in keeping with Cocoa & Swift
- * standards.
- *
- * @param tenum The enumeration
- */
-void t_cocoa_generator::generate_enum(t_enum* tenum) {
-  f_header_ << indent() << "typedef NS_ENUM(SInt32, " << cocoa_prefix_ << tenum->get_name() << ") {" << endl;
-  indent_up();
-
-  vector<t_enum_value*> constants = tenum->get_constants();
-  vector<t_enum_value*>::iterator c_iter;
-  bool first = true;
-  for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
-    if (first) {
-      first = false;
-    } else {
-      f_header_ << "," << endl;
-    }
-    f_header_ << indent() << cocoa_prefix_ << tenum->get_name() << (*c_iter)->get_name();
-    f_header_ << " = " << (*c_iter)->get_value();
-  }
-
-  indent_down();
-  f_header_ << endl << "};" << endl << endl;
-}
-
-/**
- * Generates a class that holds all the constants.
- */
-void t_cocoa_generator::generate_consts(std::vector<t_const*> consts) {
-  std::ostringstream const_interface;
-
-  const_interface << "FOUNDATION_EXPORT NSString *" << cocoa_prefix_ << capitalize(program_name_) << "ErrorDomain;" << endl
-                  << endl;
-
-
-  bool needs_class = false;
-
-  // Public constants for base types & strings
-  vector<t_const*>::iterator c_iter;
-  for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
-    t_type* type = (*c_iter)->get_type()->get_true_type();
-    if (!type->is_container() && !type->is_struct()) {
-      const_interface << "FOUNDATION_EXPORT " << type_name(type) << " "
-                      << cocoa_prefix_ << capitalize((*c_iter)->get_name()) << ";" << endl;
-    }
-    else {
-      needs_class = true;
-    }
-  }
-
-
-  string constants_class_name = cocoa_prefix_ + capitalize(program_name_) + "Constants";
-
-  if (needs_class) {
-
-    const_interface << endl;
-
-    const_interface << "@interface " << constants_class_name << " : NSObject ";
-    scope_up(const_interface);
-    scope_down(const_interface);
-
-    // getter method for each constant defined.
-    for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
-      string name = (*c_iter)->get_name();
-      t_type* type = (*c_iter)->get_type()->get_true_type();
-      if (type->is_container() || type->is_struct()) {
-        t_type* type = (*c_iter)->get_type();
-        const_interface << endl << "+ (" << type_name(type) << ") " << name << ";" << endl;
-      }
-    }
-
-    const_interface << endl << "@end";
-  }
-
-  // this gets spit into the header file in ::close_generator
-  constants_declarations_ = const_interface.str();
-
-  f_impl_ << "NSString *" << cocoa_prefix_ << capitalize(program_name_) << "ErrorDomain = "
-          << "@\"" << cocoa_prefix_ << capitalize(program_name_) << "ErrorDomain\";" << endl << endl;
-
-  // variables in the .m hold all simple constant values
-  for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
-    string name = (*c_iter)->get_name();
-    t_type* type = (*c_iter)->get_type();
-    f_impl_ << type_name(type) << " " << cocoa_prefix_ << name;
-    t_type* ttype = type->get_true_type();
-    if (!ttype->is_container() && !ttype->is_struct()) {
-      f_impl_ << " = " << render_const_value(f_impl_, type, (*c_iter)->get_value());
-    }
-    f_impl_ << ";" << endl;
-  }
-  f_impl_ << endl;
-
-  if (needs_class) {
-
-    f_impl_ << "@implementation " << constants_class_name << endl << endl;
-
-    // initialize complex constants when the class is loaded
-    f_impl_ << "+ (void) initialize ";
-    scope_up(f_impl_);
-
-    for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
-      t_type* ttype = (*c_iter)->get_type()->get_true_type();
-      if (ttype->is_container() || ttype->is_struct()) {
-        f_impl_ << endl;
-        print_const_value(f_impl_,
-                          cocoa_prefix_ + (*c_iter)->get_name(),
-                          (*c_iter)->get_type(),
-                          (*c_iter)->get_value(),
-                          false);
-        f_impl_ << ";" << endl;
-      }
-    }
-    scope_down(f_impl_);
-
-    // getter method for each constant
-    for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
-      string name = (*c_iter)->get_name();
-      t_type* type = (*c_iter)->get_type()->get_true_type();
-      if (type->is_container() || type->is_struct()) {
-        f_impl_ << endl << "+ (" << type_name(type) << ") " << name << " ";
-        scope_up(f_impl_);
-        indent(f_impl_) << "return " << cocoa_prefix_ << name << ";" << endl;
-        scope_down(f_impl_);
-      }
-    }
-
-    f_impl_ << "@end" << endl << endl;
-  }
-}
-
-/**
- * Generates a struct definition for a thrift data type. This is a class
- * with protected data members, read(), write(), and getters and setters.
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_struct(t_struct* tstruct) {
-  generate_cocoa_struct_interface(f_header_, tstruct, false);
-  generate_cocoa_struct_implementation(f_impl_, tstruct, false);
-}
-
-/**
- * Exceptions are structs, but they inherit from NSException
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_xception(t_struct* txception) {
-  generate_cocoa_struct_interface(f_header_, txception, true);
-  generate_cocoa_struct_implementation(f_impl_, txception, true);
-}
-
-/**
- * Generate the interface for a struct
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_cocoa_struct_interface(ostream& out,
-                                                        t_struct* tstruct,
-                                                        bool is_exception) {
-
-  if (is_exception) {
-    out << "enum {" << endl
-        << "  " << cocoa_prefix_ << capitalize(program_name_) << "Error" << tstruct->get_name() <<  " = -" << error_constant_++ << endl
-        << "};" << endl
-        << endl;
-  }
-
-  out << "@interface " << cocoa_prefix_ << tstruct->get_name() << " : ";
-
-  if (is_exception) {
-    out << "NSError ";
-  } else {
-    out << "NSObject ";
-  }
-  out << "<TBase, NSCoding, NSCopying> " << endl;
-
-  out << endl;
-
-  // properties
-  const vector<t_field*>& members = tstruct->get_members();
-  if (members.size() > 0) {
-    vector<t_field*>::const_iterator m_iter;
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-      out << indent() << declare_property(*m_iter) << endl;
-      out << indent() << declare_property_isset(*m_iter) << endl;
-      out << indent() << declare_property_unset(*m_iter) << endl;
-      out << endl;
-    }
-  }
-
-  out << endl;
-
-  // initializer for all fields
-  if (!members.empty()) {
-    generate_cocoa_struct_initializer_signature(out, tstruct);
-    out << ";" << endl;
-  }
-  out << endl;
-
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generate signature for initializer of struct with a parameter for
- * each field.
- */
-void t_cocoa_generator::generate_cocoa_struct_initializer_signature(ostream& out,
-                                                                    t_struct* tstruct) {
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-  indent(out) << "- (instancetype) initWith";
-  for (m_iter = members.begin(); m_iter != members.end();) {
-    if (m_iter == members.begin()) {
-      out << capitalize((*m_iter)->get_name());
-    } else {
-      out << (*m_iter)->get_name();
-    }
-    out << ": (" << type_name((*m_iter)->get_type()) << ") " << (*m_iter)->get_name();
-    ++m_iter;
-    if (m_iter != members.end()) {
-      out << " ";
-    }
-  }
-}
-
-/**
- * Generate the initWithCoder method for this struct so it's compatible with
- * the NSCoding protocol
- */
-void t_cocoa_generator::generate_cocoa_struct_init_with_coder_method(ostream& out,
-                                                                     t_struct* tstruct,
-                                                                     bool is_exception) {
-
-  indent(out) << "- (instancetype) initWithCoder: (NSCoder *) decoder" << endl;
-  scope_up(out);
-
-  if (is_exception) {
-    // NSExceptions conform to NSCoding, so we can call super
-    indent(out) << "self = [super initWithCoder: decoder];" << endl;
-  } else {
-    indent(out) << "self = [super init];" << endl;
-  }
-
-  indent(out) << "if (self) ";
-  scope_up(out);
-
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    t_type* t = get_true_type((*m_iter)->get_type());
-    out << indent() << "if ([decoder containsValueForKey: @\"" << (*m_iter)->get_name() << "\"])"
-        << endl;
-    scope_up(out);
-    out << indent() << "_" << (*m_iter)->get_name() << " = ";
-    if (type_can_be_null(t)) {
-      out << "[decoder decodeObjectForKey: @\"" << (*m_iter)->get_name() << "\"];"
-          << endl;
-    } else if (t->is_enum()) {
-      out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
-    } else {
-      t_base_type::t_base tbase = ((t_base_type*)t)->get_base();
-      switch (tbase) {
-      case t_base_type::TYPE_BOOL:
-        out << "[decoder decodeBoolForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I8:
-        out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I16:
-        out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I32:
-        out << "[decoder decodeInt32ForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I64:
-        out << "[decoder decodeInt64ForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_DOUBLE:
-        out << "[decoder decodeDoubleForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      default:
-        throw "compiler error: don't know how to decode thrift type: "
-            + t_base_type::t_base_name(tbase);
-      }
-    }
-    out << indent() << "_" << (*m_iter)->get_name() << "IsSet = YES;" << endl;
-    scope_down(out);
-  }
-
-  scope_down(out);
-
-  out << indent() << "return self;" << endl;
-  scope_down(out);
-  out << endl;
-}
-
-/**
- * Generate the encodeWithCoder method for this struct so it's compatible with
- * the NSCoding protocol
- */
-void t_cocoa_generator::generate_cocoa_struct_encode_with_coder_method(ostream& out,
-                                                                       t_struct* tstruct,
-                                                                       bool is_exception) {
-
-  indent(out) << "- (void) encodeWithCoder: (NSCoder *) encoder" << endl;
-  scope_up(out);
-
-  if (is_exception) {
-    // NSExceptions conform to NSCoding, so we can call super
-    out << indent() << "[super encodeWithCoder: encoder];" << endl;
-  }
-
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    t_type* t = get_true_type((*m_iter)->get_type());
-    out << indent() << "if (_" << (*m_iter)->get_name() << "IsSet)" << endl;
-    scope_up(out);
-    if (type_can_be_null(t)) {
-      out << indent() << "[encoder encodeObject: _" << (*m_iter)->get_name() << " forKey: @\""
-          << (*m_iter)->get_name() << "\"];" << endl;
-    } else if (t->is_enum()) {
-      out << indent() << "[encoder encodeInt: _" << (*m_iter)->get_name() << " forKey: @\""
-          << (*m_iter)->get_name() << "\"];" << endl;
-    } else {
-      t_base_type::t_base tbase = ((t_base_type*)t)->get_base();
-      switch (tbase) {
-      case t_base_type::TYPE_BOOL:
-        out << indent() << "[encoder encodeBool: _" << (*m_iter)->get_name() << " forKey: @\""
-            << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I8:
-        out << indent() << "[encoder encodeInt: _" << (*m_iter)->get_name() << " forKey: @\""
-            << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I16:
-        out << indent() << "[encoder encodeInt: _" << (*m_iter)->get_name() << " forKey: @\""
-            << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I32:
-        out << indent() << "[encoder encodeInt32: _" << (*m_iter)->get_name() << " forKey: @\""
-            << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_I64:
-        out << indent() << "[encoder encodeInt64: _" << (*m_iter)->get_name() << " forKey: @\""
-            << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      case t_base_type::TYPE_DOUBLE:
-        out << indent() << "[encoder encodeDouble: _" << (*m_iter)->get_name() << " forKey: @\""
-            << (*m_iter)->get_name() << "\"];" << endl;
-        break;
-      default:
-        throw "compiler error: don't know how to encode thrift type: "
-            + t_base_type::t_base_name(tbase);
-      }
-    }
-    scope_down(out);
-  }
-
-  scope_down(out);
-  out << endl;
-}
-
-/**
- * Generate the copy method for this struct
- */
-void t_cocoa_generator::generate_cocoa_struct_copy_method(ostream& out, t_struct* tstruct, bool is_exception) {
-  out << indent() << "- (instancetype) copyWithZone:(NSZone *)zone" << endl;
-  scope_up(out);
-
-  if (is_exception) {
-    out << indent() << type_name(tstruct) << " val = [" << cocoa_prefix_ << tstruct->get_name() << " errorWithDomain: self.domain code: self.code userInfo: self.userInfo];" << endl;
-  } else {
-    out << indent() << type_name(tstruct) << " val = [" << cocoa_prefix_ << tstruct->get_name() << " new];" << endl;
-  }
-
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    t_type* t = get_true_type((*m_iter)->get_type());
-    out << indent() << "if (_" << (*m_iter)->get_name() << "IsSet)" << endl;
-    scope_up(out);
-    if (type_can_be_null(t)) {
-      out << indent() << "val." << (*m_iter)->get_name() << " = [self." << (*m_iter)->get_name() << " copy];";
-    } else {
-      out << indent() << "val." << (*m_iter)->get_name() << " = self." << (*m_iter)->get_name() << ";";
-    }
-    out << endl;
-    scope_down(out);
-  }
-
-  out << indent() << "return val;" << endl;
-
-  scope_down(out);
-  out << endl;
-}
-
-/**
- * Generate the hash method for this struct
- */
-void t_cocoa_generator::generate_cocoa_struct_hash_method(ostream& out, t_struct* tstruct) {
-  indent(out) << "- (NSUInteger) hash" << endl;
-  scope_up(out);
-  out << indent() << "NSUInteger hash = 17;" << endl;
-
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    t_type* t = get_true_type((*m_iter)->get_type());
-    out << indent() << "hash = (hash * 31) ^ _" << (*m_iter)->get_name()
-        << "IsSet ? 2654435761 : 0;" << endl;
-    out << indent() << "if (_" << (*m_iter)->get_name() << "IsSet)" << endl;
-    scope_up(out);
-    if (type_can_be_null(t)) {
-      out << indent() << "hash = (hash * 31) ^ [_" << (*m_iter)->get_name() << " hash];" << endl;
-    } else {
-      out << indent() << "hash = (hash * 31) ^ [@(_" << (*m_iter)->get_name() << ") hash];"
-          << endl;
-    }
-    scope_down(out);
-  }
-
-  out << indent() << "return hash;" << endl;
-  scope_down(out);
-  out << endl;
-}
-
-/**
- * Generate the isEqual method for this struct
- */
-void t_cocoa_generator::generate_cocoa_struct_is_equal_method(ostream& out, t_struct* tstruct, bool is_exception) {
-  indent(out) << "- (BOOL) isEqual: (id) anObject" << endl;
-  scope_up(out);
-
-  indent(out) << "if (self == anObject) {" << endl;
-  indent_up();
-  indent(out) << "return YES;" << endl;
-  indent_down();
-  indent(out) << "}" << endl;
-
-  string class_name = cocoa_prefix_ + tstruct->get_name();
-
-  if (is_exception) {
-    indent(out) << "if (![super isEqual:anObject]) {" << endl;
-    indent_up();
-    indent(out) << "return NO;" << endl;
-    indent_down();
-    indent(out) << "}" << endl << endl;
-  }
-  else {
-    indent(out) << "if (![anObject isKindOfClass:[" << class_name << " class]]) {" << endl;
-    indent_up();
-    indent(out) << "return NO;" << endl;
-    indent_down();
-    indent(out) << "}" << endl;
-  }
-
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  if (!members.empty()) {
-    indent(out) << class_name << " *other = (" << class_name << " *)anObject;" << endl;
-
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-      t_type* t = get_true_type((*m_iter)->get_type());
-      string name = (*m_iter)->get_name();
-      if (type_can_be_null(t)) {
-        out << indent() << "if ((_" << name << "IsSet != other->_" << name << "IsSet) ||" << endl
-            << indent() << "    "
-            << "(_" << name << "IsSet && "
-            << "((_" << name << " || other->_" << name << ") && "
-            << "![_" << name << " isEqual:other->_" << name << "]))) {" << endl;
-      } else {
-        out << indent() << "if ((_" << name << "IsSet != other->_" << name << "IsSet) ||" << endl
-            << indent() << "    "
-            << "(_" << name << "IsSet && "
-            << "(_" << name << " != other->_" << name << "))) {" << endl;
-      }
-      indent_up();
-      indent(out) << "return NO;" << endl;
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-  }
-
-  out << indent() << "return YES;" << endl;
-  scope_down(out);
-  out << endl;
-}
-
-/**
- * Generate struct implementation.
- *
- * @param tstruct      The struct definition
- * @param is_exception Is this an exception?
- * @param is_result    If this is a result it needs a different writer
- */
-void t_cocoa_generator::generate_cocoa_struct_implementation(ostream& out,
-                                                             t_struct* tstruct,
-                                                             bool is_exception,
-                                                             bool is_result) {
-  indent(out) << "@implementation " << cocoa_prefix_ << tstruct->get_name() << endl << endl;
-
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  // exceptions need to call the designated initializer on NSException
-  if (is_exception) {
-    out << indent() << "- (instancetype) init" << endl;
-    scope_up(out);
-    out << indent() << "return [super initWithDomain: " << cocoa_prefix_ << capitalize(program_name_) << "ErrorDomain" << endl
-        << indent() << "                        code: " << cocoa_prefix_ << capitalize(program_name_) << "Error" << tstruct->get_name() << endl
-        << indent() << "                    userInfo: nil];" << endl;
-    scope_down(out);
-    out << endl;
-  } else {
-    // struct
-
-    // default initializer
-    // setup instance variables with default values
-    indent(out) << "- (instancetype) init" << endl;
-    scope_up(out);
-    indent(out) << "self = [super init];" << endl;
-    indent(out) << "if (self)";
-    scope_up(out);
-    if (members.size() > 0) {
-      for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-        t_type* t = get_true_type((*m_iter)->get_type());
-        if ((*m_iter)->get_value() != NULL) {
-          print_const_value(out,
-                            "self." + (*m_iter)->get_name(),
-                            t,
-                            (*m_iter)->get_value(),
-                            false);
-        }
-      }
-    }
-    scope_down(out);
-    indent(out) << "return self;" << endl;
-    scope_down(out);
-    out << endl;
-  }
-
-  // initializer with all fields as params
-  if (!members.empty()) {
-    generate_cocoa_struct_initializer_signature(out, tstruct);
-    out << endl;
-    scope_up(out);
-    if (is_exception) {
-      out << indent() << "self = [self init];" << endl;
-    } else {
-      out << indent() << "self = [super init];" << endl;
-    }
-
-    indent(out) << "if (self)";
-    scope_up(out);
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-      out << indent() << "_" << (*m_iter)->get_name() << " = ";
-      if (get_true_type((*m_iter)->get_type())->is_container()) {
-        out << "[" << (*m_iter)->get_name() << " mutableCopy];" << endl;
-      } else {
-        out << (*m_iter)->get_name() << ";" << endl;
-      }
-      out << indent() << "_" << (*m_iter)->get_name() << "IsSet = YES;" << endl;
-    }
-    scope_down(out);
-
-    out << indent() << "return self;" << endl;
-    scope_down(out);
-    out << endl;
-  }
-
-  // initWithCoder for NSCoding
-  generate_cocoa_struct_init_with_coder_method(out, tstruct, is_exception);
-  // encodeWithCoder for NSCoding
-  generate_cocoa_struct_encode_with_coder_method(out, tstruct, is_exception);
-  // hash and isEqual for NSObject
-  generate_cocoa_struct_hash_method(out, tstruct);
-  generate_cocoa_struct_is_equal_method(out, tstruct, is_exception);
-  // copy for NSObject
-  generate_cocoa_struct_copy_method(out, tstruct, is_exception);
-
-  // the rest of the methods
-  generate_cocoa_struct_field_accessor_implementations(out, tstruct, is_exception);
-  generate_cocoa_struct_reader(out, tstruct);
-  if (is_result) {
-    generate_cocoa_struct_result_writer(out, tstruct);
-  } else {
-    generate_cocoa_struct_writer(out, tstruct);
-  }
-  generate_cocoa_struct_validator(out, tstruct);
-  generate_cocoa_struct_description(out, tstruct);
-
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generates a function to read all the fields of the struct.
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_cocoa_struct_reader(ostream& out, t_struct* tstruct) {
-  out << "- (BOOL) read: (id <TProtocol>) inProtocol error: (NSError *__autoreleasing *)__thriftError" << endl;
-  scope_up(out);
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  // Declare stack tmp variables
-  indent(out) << "NSString * fieldName;" << endl;
-  indent(out) << "SInt32 fieldType;" << endl;
-  indent(out) << "SInt32 fieldID;" << endl;
-  out << endl;
-
-  indent(out) << "if (![inProtocol readStructBeginReturningName: NULL error: __thriftError]) return NO;" << endl;
-
-  // Loop over reading in fields
-  indent(out) << "while (true)" << endl;
-  scope_up(out);
-
-  // Read beginning field marker
-  indent(out)
-      << "if (![inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID error: __thriftError]) return NO;"
-      << endl;
-
-  // Check for field STOP marker and break
-  indent(out) << "if (fieldType == TTypeSTOP) { " << endl;
-  indent_up();
-  indent(out) << "break;" << endl;
-  indent_down();
-  indent(out) << "}" << endl;
-
-  // Switch statement on the field we are reading
-  indent(out) << "switch (fieldID)" << endl;
-
-  scope_up(out);
-
-  // Generate deserialization code for known cases
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    indent(out) << "case " << (*f_iter)->get_key() << ":" << endl;
-    indent_up();
-    indent(out) << "if (fieldType == " << type_to_enum((*f_iter)->get_type()) << ") {" << endl;
-    indent_up();
-
-    generate_deserialize_field(out, *f_iter, "fieldValue");
-    indent(out) << call_field_setter(*f_iter, "fieldValue") << endl;
-
-    indent_down();
-    out << indent() << "} else { " << endl;
-    if (log_unexpected_) {
-      out << indent() << "  NSLog(@\"%s: field ID %i has unexpected type %i.  Skipping.\", "
-                         "__PRETTY_FUNCTION__, (int)fieldID, (int)fieldType);" << endl;
-    }
-
-    out << indent() << "  if (![TProtocolUtil skipType: fieldType onProtocol: inProtocol error: __thriftError]) return NO;" << endl;
-    out << indent() << "}" << endl << indent() << "break;" << endl;
-    indent_down();
-  }
-
-  // In the default case we skip the field
-  out << indent() << "default:" << endl;
-  if (log_unexpected_) {
-    out << indent() << "  NSLog(@\"%s: unexpected field ID %i with type %i.  Skipping.\", "
-                       "__PRETTY_FUNCTION__, (int)fieldID, (int)fieldType);" << endl;
-  }
-
-  out << indent() << "  if (![TProtocolUtil skipType: fieldType onProtocol: inProtocol error: __thriftError]) return NO;" << endl;
-
-  out << indent() << "  break;" << endl;
-
-  scope_down(out);
-
-  // Read field end marker
-  indent(out) << "if (![inProtocol readFieldEnd: __thriftError]) return NO;" << endl;
-
-  scope_down(out);
-
-  out << indent() << "if (![inProtocol readStructEnd: __thriftError]) return NO;" << endl;
-
-  // performs various checks (e.g. check that all required fields are set)
-  if (validate_required_) {
-    out << indent() << "if (![self validate: __thriftError]) return NO;" << endl;
-  }
-
-  indent(out) << "return YES;" << endl;
-
-  indent_down();
-  out << indent() << "}" << endl << endl;
-}
-
-/**
- * Generates a function to write all the fields of the struct
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_cocoa_struct_writer(ostream& out, t_struct* tstruct) {
-  out << indent() << "- (BOOL) write: (id <TProtocol>) outProtocol error: (NSError *__autoreleasing *)__thriftError {" << endl;
-  indent_up();
-
-  string name = tstruct->get_name();
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  out << indent() << "if (![outProtocol writeStructBeginWithName: @\"" << name << "\" error: __thriftError]) return NO;" << endl;
-
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    out << indent() << "if (_" << (*f_iter)->get_name() << "IsSet) {" << endl;
-    indent_up();
-    bool null_allowed = type_can_be_null((*f_iter)->get_type());
-    if (null_allowed) {
-      out << indent() << "if (_" << (*f_iter)->get_name() << " != nil) {" << endl;
-      indent_up();
-    }
-
-    indent(out) << "if (![outProtocol writeFieldBeginWithName: @\"" << (*f_iter)->get_name()
-                << "\" type: " << type_to_enum((*f_iter)->get_type())
-                << " fieldID: " << (*f_iter)->get_key() << " error: __thriftError]) return NO;" << endl;
-
-    // Write field contents
-    generate_serialize_field(out, *f_iter, "_" + (*f_iter)->get_name());
-
-    // Write field closer
-    indent(out) << "if (![outProtocol writeFieldEnd: __thriftError]) return NO;" << endl;
-
-    if (null_allowed) {
-      scope_down(out);
-    }
-    scope_down(out);
-  }
-  // Write the struct map
-  out << indent() << "if (![outProtocol writeFieldStop: __thriftError]) return NO;" << endl
-      << indent() << "if (![outProtocol writeStructEnd: __thriftError]) return NO;" << endl;
-
-  indent(out) << "return YES;" << endl;
-
-  indent_down();
-  out << indent() << "}" << endl << endl;
-}
-
-/**
- * Generates a function to write all the fields of the struct, which
- * is a function result. These fields are only written if they are
- * set, and only one of them can be set at a time.
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_cocoa_struct_result_writer(ostream& out, t_struct* tstruct) {
-  out << indent() << "- (BOOL) write: (id <TProtocol>) outProtocol error: (NSError *__autoreleasing *)__thriftError {" << endl;
-  indent_up();
-
-  string name = tstruct->get_name();
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  out << indent() << "if (![outProtocol writeStructBeginWithName: @\"" << name << "\" error: __thriftError]) return NO;" << endl;
-
-  bool first = true;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if (first) {
-      first = false;
-      out << endl << indent() << "if ";
-    } else {
-      out << " else if ";
-    }
-
-    out << "(_" << (*f_iter)->get_name() << "IsSet) {" << endl;
-    indent_up();
-
-    bool null_allowed = type_can_be_null((*f_iter)->get_type());
-    if (null_allowed) {
-      out << indent() << "if (_" << (*f_iter)->get_name() << " != nil) {" << endl;
-      indent_up();
-    }
-
-    indent(out) << "if (![outProtocol writeFieldBeginWithName: @\"" << (*f_iter)->get_name()
-                << "\" type: " << type_to_enum((*f_iter)->get_type())
-                << " fieldID: " << (*f_iter)->get_key() << " error: __thriftError]) return NO;" << endl;
-
-    // Write field contents
-    generate_serialize_field(out, *f_iter, "_" + (*f_iter)->get_name());
-
-    // Write field closer
-    indent(out) << "if (![outProtocol writeFieldEnd: __thriftError]) return NO;" << endl;
-
-    if (null_allowed) {
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-
-    indent_down();
-    indent(out) << "}";
-  }
-  // Write the struct map
-  out << endl << indent() << "if (![outProtocol writeFieldStop: __thriftError]) return NO;"
-      << endl << indent() << "if (![outProtocol writeStructEnd: __thriftError]) return NO;"
-      << endl;
-
-  indent(out) << "return YES;" << endl;
-
-  indent_down();
-  out << indent() << "}" << endl << endl;
-}
-
-/**
- * Generates a function to perform various checks
- * (e.g. check that all required fields are set)
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_cocoa_struct_validator(ostream& out, t_struct* tstruct) {
-  out << indent() << "- (BOOL) validate: (NSError *__autoreleasing *)__thriftError {" << endl;
-  indent_up();
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  out << indent() << "// check for required fields" << endl;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    t_field* field = (*f_iter);
-    if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
-      out << indent() << "if (!_" << field->get_name() << "IsSet) ";
-      scope_up(out);
-      indent(out) << "if (__thriftError) ";
-      scope_up(out);
-      out << indent() << "*__thriftError = [NSError errorWithDomain: TProtocolErrorDomain" << endl
-          << indent() << "                                     code: TProtocolErrorUnknown" << endl
-          << indent() << "                                 userInfo: @{TProtocolErrorExtendedErrorKey: @(TProtocolExtendedErrorMissingRequiredField)," << endl
-          << indent() << "                                             TProtocolErrorFieldNameKey: @\"" << (*f_iter)->get_name() << "\"}];" << endl;
-      scope_down(out);
-      scope_down(out);
-    }
-  }
-  indent(out) << "return YES;" << endl;
-  indent_down();
-  out << indent() << "}" << endl << endl;
-}
-
-/**
- * Generate property accessor methods for all fields in the struct.
- * getter, setter, isset getter.
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_cocoa_struct_field_accessor_implementations(ostream& out,
-                                                                             t_struct* tstruct,
-                                                                             bool is_exception) {
-  (void)is_exception;
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    t_field* field = *f_iter;
-    t_type* type = get_true_type(field->get_type());
-    std::string field_name = field->get_name();
-    std::string cap_name = field_name;
-    cap_name[0] = toupper(cap_name[0]);
-
-    // Simple setter
-    indent(out) << "- (void) set" << cap_name << ": (" << type_name(type, false, true) << ") " << field_name
-                << " {" << endl;
-    indent_up();
-    indent(out) << "_" << field_name << " = " << field_name << ";" << endl;
-    indent(out) << "_" << field_name << "IsSet = YES;" << endl;
-    indent_down();
-    indent(out) << "}" << endl << endl;
-
-    // Unsetter - do we need this?
-    indent(out) << "- (void) unset" << cap_name << " {" << endl;
-    indent_up();
-    if (type_can_be_null(type)) {
-      indent(out) << "_" << field_name << " = nil;" << endl;
-    }
-    indent(out) << "_" << field_name << "IsSet = NO;" << endl;
-    indent_down();
-    indent(out) << "}" << endl << endl;
-  }
-}
-
-/**
- * Generates a description method for the given struct
- *
- * @param tstruct The struct definition
- */
-void t_cocoa_generator::generate_cocoa_struct_description(ostream& out, t_struct* tstruct) {
-
-  // Allow use of debugDescription so the app can add description via a cateogory/extension
-  if (debug_descriptions_) {
-    out << indent() << "- (NSString *) debugDescription {" << endl;
-  }
-  else {
-    out << indent() << "- (NSString *) description {" << endl;
-  }
-  indent_up();
-
-  out << indent() << "NSMutableString * ms = [NSMutableString stringWithString: @\""
-      << cocoa_prefix_ << tstruct->get_name() << "(\"];" << endl;
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  bool first = true;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if (first) {
-      first = false;
-      indent(out) << "[ms appendString: @\"" << (*f_iter)->get_name() << ":\"];" << endl;
-    } else {
-      indent(out) << "[ms appendString: @\"," << (*f_iter)->get_name() << ":\"];" << endl;
-    }
-    t_type* ttype = (*f_iter)->get_type();
-    indent(out) << "[ms appendFormat: @\"" << format_string_for_type(ttype) << "\", "
-                << format_cast_for_type(ttype) << "_" << (*f_iter)->get_name() << "];" << endl;
-  }
-  out << indent() << "[ms appendString: @\")\"];" << endl << indent()
-      << "return [NSString stringWithString: ms];" << endl;
-
-  indent_down();
-  indent(out) << "}" << endl << endl;
-}
-
-/**
- * Generates a thrift service.  In Objective-C this consists of a
- * protocol definition, a client interface and a client implementation.
- *
- * @param tservice The service definition
- */
-void t_cocoa_generator::generate_service(t_service* tservice) {
-  generate_cocoa_service_protocol(f_header_, tservice);
-  generate_cocoa_service_client_interface(f_header_, tservice);
-  generate_cocoa_service_server_interface(f_header_, tservice);
-  generate_cocoa_service_helpers(tservice);
-  generate_cocoa_service_client_implementation(f_impl_, tservice);
-  generate_cocoa_service_server_implementation(f_impl_, tservice);
-  if (async_clients_) {
-    generate_cocoa_service_async_protocol(f_header_, tservice);
-    generate_cocoa_service_client_async_interface(f_header_, tservice);
-    generate_cocoa_service_client_async_implementation(f_impl_, tservice);
-  }
-}
-
-/**
- * Generates structs for all the service return types
- *
- * @param tservice The service
- */
-void t_cocoa_generator::generate_cocoa_service_helpers(t_service* tservice) {
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
-    t_struct* ts = (*f_iter)->get_arglist();
-
-    string qname = function_args_helper_struct_type(tservice, *f_iter);
-
-    t_struct qname_ts = t_struct(ts->get_program(), qname);
-
-    const vector<t_field*>& members = ts->get_members();
-    vector<t_field*>::const_iterator m_iter;
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-      qname_ts.append(*m_iter);
-    }
-
-    generate_cocoa_struct_interface(f_impl_, &qname_ts, false);
-    generate_cocoa_struct_implementation(f_impl_, &qname_ts, false, false);
-    generate_function_helpers(tservice, *f_iter);
-  }
-}
-
-string t_cocoa_generator::function_result_helper_struct_type(t_service *tservice, t_function* tfunction) {
-  if (tfunction->is_oneway()) {
-    return tservice->get_name() + "_" + tfunction->get_name();
-  } else {
-    return tservice->get_name() + "_" + tfunction->get_name() + "_result";
-  }
-}
-
-string t_cocoa_generator::function_args_helper_struct_type(t_service *tservice, t_function* tfunction) {
-  return tservice->get_name() + "_" + tfunction->get_name() + "_args";
-}
-
-/**
- * Generates a struct and helpers for a function.
- *
- * @param tfunction The function
- */
-void t_cocoa_generator::generate_function_helpers(t_service *tservice, t_function* tfunction) {
-  if (tfunction->is_oneway()) {
-    return;
-  }
-
-  // create a result struct with a success field of the return type,
-  // and a field for each type of exception thrown
-  t_struct result(program_, function_result_helper_struct_type(tservice, tfunction));
-  t_field success(tfunction->get_returntype(), "success", 0);
-  if (!tfunction->get_returntype()->is_void()) {
-    result.append(&success);
-  }
-
-  t_struct* xs = tfunction->get_xceptions();
-  const vector<t_field*>& fields = xs->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    result.append(*f_iter);
-  }
-
-  // generate the result struct
-  generate_cocoa_struct_interface(f_impl_, &result, false);
-  generate_cocoa_struct_implementation(f_impl_, &result, false, true);
-}
-
-/**
- * Generates a service protocol definition.
- *
- * @param tservice The service to generate a protocol definition for
- */
-void t_cocoa_generator::generate_cocoa_service_protocol(ostream& out, t_service* tservice) {
-  out << "@protocol " << cocoa_prefix_ << tservice->get_name() << " <NSObject>" << endl;
-
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    out << "- " << function_signature(*f_iter, true) << ";"
-        << "  // throws ";
-    t_struct* xs = (*f_iter)->get_xceptions();
-    const std::vector<t_field*>& xceptions = xs->get_members();
-    vector<t_field*>::const_iterator x_iter;
-    for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
-      out << type_name((*x_iter)->get_type()) + ", ";
-    }
-    out << "TException" << endl;
-  }
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generates an asynchronous service protocol definition.
- *
- * @param tservice The service to generate a protocol definition for
- */
-void t_cocoa_generator::generate_cocoa_service_async_protocol(ostream& out, t_service* tservice) {
-  out << "@protocol " << cocoa_prefix_ << tservice->get_name() << "Async"
-      << " <NSObject>" << endl;
-
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    out << "- " << async_function_signature(*f_iter, false) << ";" << endl;
-    if (promise_kit_) {
-      out << "- " << promise_function_signature(*f_iter) << ";" << endl;
-    }
-  }
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generates a service client interface definition.
- *
- * @param tservice The service to generate a client interface definition for
- */
-void t_cocoa_generator::generate_cocoa_service_client_interface(ostream& out,
-                                                                t_service* tservice) {
-  out << "@interface " << cocoa_prefix_ << tservice->get_name() << "Client : TBaseClient <"
-      << cocoa_prefix_ << tservice->get_name() << "> " << endl;
-
-  out << "- (id) initWithProtocol: (id <TProtocol>) protocol;" << endl;
-  out << "- (id) initWithInProtocol: (id <TProtocol>) inProtocol outProtocol: (id <TProtocol>) "
-         "outProtocol;" << endl;
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generates a service client interface definition.
- *
- * @param tservice The service to generate a client interface definition for
- */
-void t_cocoa_generator::generate_cocoa_service_client_async_interface(ostream& out,
-                                                                      t_service* tservice) {
-  out << "@interface " << cocoa_prefix_ << tservice->get_name() << "ClientAsync : TBaseClient <"
-      << cocoa_prefix_ << tservice->get_name() << "Async> " << endl
-      << endl;
-
-  out << "- (id) initWithProtocolFactory: (id <TProtocolFactory>) protocolFactory "
-      << "transportFactory: (id <TAsyncTransportFactory>) transportFactory;" << endl;
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generates a service server interface definition. In other words, the TProcess implementation for
- *the
- * service definition.
- *
- * @param tservice The service to generate a client interface definition for
- */
-void t_cocoa_generator::generate_cocoa_service_server_interface(ostream& out,
-                                                                t_service* tservice) {
-  out << "@interface " << cocoa_prefix_ << tservice->get_name()
-      << "Processor : NSObject <TProcessor> " << endl;
-
-  out << "- (id) initWith" << tservice->get_name() << ": (id <" << cocoa_prefix_
-      << tservice->get_name() << ">) service;" << endl;
-  out << "- (id<" << cocoa_prefix_ << tservice->get_name() << ">) service;" << endl;
-
-  out << "@end" << endl << endl;
-}
-
-void t_cocoa_generator::generate_cocoa_service_client_send_function_implementation(
-    ostream& out,
-    t_service *tservice,
-    t_function* tfunction,
-    bool needs_protocol) {
-  string funname = tfunction->get_name();
-
-  t_function send_function(g_type_bool,
-                           string("send_") + tfunction->get_name(),
-                           tfunction->get_arglist());
-
-  string argsname = function_args_helper_struct_type(tservice, tfunction);
-
-  // Open function
-  indent(out) << "- (BOOL) send_" << tfunction->get_name() << argument_list(tfunction->get_arglist(), needs_protocol ? "outProtocol" : "", true) << endl;
-  scope_up(out);
-
-  // Serialize the request
-  out << indent() << "if (![outProtocol writeMessageBeginWithName: @\"" << funname << "\""
-      << (tfunction->is_oneway() ? " type: TMessageTypeONEWAY" : " type: TMessageTypeCALL")
-      << " sequenceID: 0 error: __thriftError]) return NO;" << endl;
-
-  out << indent() << "if (![outProtocol writeStructBeginWithName: @\"" << argsname
-                  << "\" error: __thriftError]) return NO;" << endl;
-
-  // write out function parameters
-  t_struct* arg_struct = tfunction->get_arglist();
-  const vector<t_field*>& fields = arg_struct->get_members();
-  vector<t_field*>::const_iterator fld_iter;
-  for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
-    string fieldName = (*fld_iter)->get_name();
-    if (type_can_be_null((*fld_iter)->get_type())) {
-      out << indent() << "if (" << fieldName << " != nil)";
-      scope_up(out);
-    }
-    out << indent() << "if (![outProtocol writeFieldBeginWithName: @\"" << fieldName
-        << "\""
-           " type: " << type_to_enum((*fld_iter)->get_type())
-        << " fieldID: " << (*fld_iter)->get_key() << " error: __thriftError]) return NO;" << endl;
-
-    generate_serialize_field(out, *fld_iter, fieldName);
-
-    out << indent() << "if (![outProtocol writeFieldEnd: __thriftError]) return NO;" << endl;
-
-    if (type_can_be_null((*fld_iter)->get_type())) {
-      indent_down();
-      out << indent() << "}" << endl;
-    }
-  }
-
-  out << indent() << "if (![outProtocol writeFieldStop: __thriftError]) return NO;" << endl;
-  out << indent() << "if (![outProtocol writeStructEnd: __thriftError]) return NO;" << endl;
-  out << indent() << "if (![outProtocol writeMessageEnd: __thriftError]) return NO;" << endl;
-  out << indent() << "return YES;" << endl;
-  scope_down(out);
-  out << endl;
-}
-
-void t_cocoa_generator::generate_cocoa_service_client_recv_function_implementation(
-    ostream& out,
-    t_service* tservice,
-    t_function* tfunction,
-    bool needs_protocol) {
-
-
-  // Open function
-  indent(out) << "- (BOOL) recv_" << tfunction->get_name();
-  if (!tfunction->get_returntype()->is_void()) {
-    out << ": (" << type_name(tfunction->get_returntype(), false, true) << " *) result ";
-    if (needs_protocol) {
-      out << "protocol";
-    } else {
-      out << "error";
-    }
-  }
-  if (needs_protocol) {
-    out << ": (id<TProtocol>) inProtocol error";
-  }
-  out << ": (NSError *__autoreleasing *)__thriftError" << endl;
-  scope_up(out);
-
-  // TODO(mcslee): Message validation here, was the seqid etc ok?
-
-  // check for an exception
-  out << indent() << "NSError *incomingException = [self checkIncomingMessageException: inProtocol];" << endl
-      << indent() << "if (incomingException)";
-  scope_up(out);
-  out << indent() << "if (__thriftError)";
-  scope_up(out);
-  out << indent() << "*__thriftError = incomingException;" << endl;
-  scope_down(out);
-  out << indent() << "return NO;" << endl;
-  scope_down(out);
-
-  // FIXME - could optimize here to reduce creation of temporary objects.
-  string resultname = function_result_helper_struct_type(tservice, tfunction);
-  out << indent() << cocoa_prefix_ << resultname << " * resulter = [" << cocoa_prefix_ << resultname << " new];" << endl;
-  indent(out) << "if (![resulter read: inProtocol error: __thriftError]) return NO;" << endl;
-  indent(out) << "if (![inProtocol readMessageEnd: __thriftError]) return NO;" << endl;
-
-  // Careful, only return _result if not a void function
-  if (!tfunction->get_returntype()->is_void()) {
-    out << indent() << "if (resulter.successIsSet)";
-    scope_up(out);
-    out << indent() << "*result = resulter.success;" << endl;
-    out << indent() << "return YES;" << endl;
-    scope_down(out);
-  }
-
-  t_struct* xs = tfunction->get_xceptions();
-  const std::vector<t_field*>& xceptions = xs->get_members();
-  vector<t_field*>::const_iterator x_iter;
-  for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
-    out << indent() << "if (resulter." << (*x_iter)->get_name() << "IsSet)";
-    scope_up(out);
-    out << indent() << "if (__thriftError)";
-    scope_up(out);
-    out << indent() << "*__thriftError = [resulter " << (*x_iter)->get_name() << "];" << endl;
-    scope_down(out);
-    out << indent() << "return NO;" << endl;
-    scope_down(out);
-  }
-
-  // If you get here it's an exception, unless a void function
-  if (tfunction->get_returntype()->is_void()) {
-    indent(out) << "return YES;" << endl;
-  } else {
-    out << indent() << "if (__thriftError)";
-    scope_up(out);
-    out << indent() << "*__thriftError = [NSError errorWithDomain: TApplicationErrorDomain" << endl
-        << indent() << "                                     code: TApplicationErrorMissingResult" << endl
-        << indent() << "                                 userInfo: @{TApplicationErrorMethodKey: @\""
-        << tfunction->get_name() << "\"}];" << endl;
-    scope_down(out);
-    out << indent() << "return NO;" << endl;
-  }
-
-  // Close function
-  scope_down(out);
-  out << endl;
-}
-
-/**
- * Generates an invocation of a given 'send_' function.
- *
- * @param tfunction The service to generate an implementation for
- */
-void t_cocoa_generator::generate_cocoa_service_client_send_function_invocation(
-                                                                               ostream& out,
-                                                                               t_function* tfunction) {
-
-  t_struct* arg_struct = tfunction->get_arglist();
-  const vector<t_field*>& fields = arg_struct->get_members();
-  vector<t_field*>::const_iterator fld_iter;
-  out << indent() << "if (![self send_" << tfunction->get_name();
-  bool first = true;
-  for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
-    string fieldName = (*fld_iter)->get_name();
-    out << " ";
-    if (first) {
-      first = false;
-      out << ": " << fieldName;
-    } else {
-      out << fieldName << ": " << fieldName;
-    }
-  }
-  if (!fields.empty()) {
-    out << " error";
-  }
-  out << ": __thriftError]) " << invalid_return_statement(tfunction) << endl;
-}
-
-/**
- * Generates an invocation of a given 'send_' function.
- *
- * @param tfunction The service to generate an implementation for
- */
-void t_cocoa_generator::generate_cocoa_service_client_send_async_function_invocation(
-                                                                                     ostream& out,
-                                                                                     t_function* tfunction,
-                                                                                     string failureBlockName) {
-
-  t_struct* arg_struct = tfunction->get_arglist();
-  const vector<t_field*>& fields = arg_struct->get_members();
-  vector<t_field*>::const_iterator fld_iter;
-  out << indent() << "if (![self send_" << tfunction->get_name();
-  bool first = true;
-  for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
-    string fieldName = (*fld_iter)->get_name();
-    out << " ";
-    if (first) {
-      first = false;
-      out << ": " << fieldName;
-    } else {
-      out << fieldName << ": " << fieldName;
-    }
-  }
-  if (!fields.empty()) {
-    out << " protocol";
-  }
-  out << ": protocol error: &thriftError]) ";
-  scope_up(out);
-  out << indent() << failureBlockName << "(thriftError);" << endl
-      << indent() << "return;" << endl;
-  scope_down(out);
-}
-
-/**
- * Generates a service client implementation.
- *
- * @param tservice The service to generate an implementation for
- */
-void t_cocoa_generator::generate_cocoa_service_client_implementation(ostream& out,
-                                                                     t_service* tservice) {
-
-  string name = cocoa_prefix_ + tservice->get_name() + "Client";
-
-  out << "@interface " << name << " () ";
-  scope_up(out);
-  out << endl;
-  out << indent() << "id<TProtocol> inProtocol;" << endl;
-  out << indent() << "id<TProtocol> outProtocol;" << endl;
-  out << endl;
-  scope_down(out);
-  out << endl;
-  out << "@end" << endl << endl;
-
-  out << "@implementation " << name << endl;
-
-  // initializers
-  out << "- (id) initWithProtocol: (id <TProtocol>) protocol" << endl;
-  scope_up(out);
-  out << indent() << "return [self initWithInProtocol: protocol outProtocol: protocol];" << endl;
-  scope_down(out);
-  out << endl;
-
-  out << "- (id) initWithInProtocol: (id <TProtocol>) anInProtocol outProtocol: (id <TProtocol>) "
-         "anOutProtocol" << endl;
-  scope_up(out);
-  out << indent() << "self = [super init];" << endl;
-  out << indent() << "if (self) ";
-  scope_up(out);
-  out << indent() << "inProtocol = anInProtocol;" << endl;
-  out << indent() << "outProtocol = anOutProtocol;" << endl;
-  scope_down(out);
-  out << indent() << "return self;" << endl;
-  scope_down(out);
-  out << endl;
-
-  // generate client method implementations
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
-    generate_cocoa_service_client_send_function_implementation(out, tservice, *f_iter, false);
-
-    if (!(*f_iter)->is_oneway()) {
-      generate_cocoa_service_client_recv_function_implementation(out, tservice, *f_iter, false);
-    }
-
-    // Open function
-    indent(out) << "- " << function_signature(*f_iter, true) << endl;
-    scope_up(out);
-    generate_cocoa_service_client_send_function_invocation(out, *f_iter);
-
-    out << indent() << "if (![[outProtocol transport] flush: __thriftError]) " << invalid_return_statement(*f_iter) << endl;
-    if (!(*f_iter)->is_oneway()) {
-      if ((*f_iter)->get_returntype()->is_void()) {
-        out << indent() << "if (![self recv_" << (*f_iter)->get_name() << ": __thriftError]) return NO;" << endl;
-        out << indent() << "return YES;" << endl;
-      } else {
-        out << indent() << type_name((*f_iter)->get_returntype(), false, true) << " __result;" << endl
-            << indent() << "if (![self recv_" << (*f_iter)->get_name() << ": &__result error: __thriftError]) "
-            << invalid_return_statement(*f_iter) << endl;
-        if (type_can_be_null((*f_iter)->get_returntype())) {
-          out << indent() << "return __result;" << endl;
-        } else {
-          out << indent() << "return @(__result);" << endl;
-        }
-      }
-    }
-    else {
-      out << indent() << "return YES;" << endl;
-    }
-    scope_down(out);
-    out << endl;
-  }
-
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generates a service client implementation for its asynchronous interface.
- *
- * @param tservice The service to generate an implementation for
- */
-void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ostream& out,
-                                                                           t_service* tservice) {
-
-  string name = cocoa_prefix_ + tservice->get_name() + "ClientAsync";
-
-  out << "@interface " << name << " () ";
-  scope_up(out);
-  out << endl;
-  out << indent() << "id<TProtocolFactory> protocolFactory;" << endl;
-  out << indent() << "id<TAsyncTransportFactory> transportFactory;" << endl;
-  out << endl;
-  scope_down(out);
-  out << endl;
-  out << "@end" << endl << endl;
-
-
-  out << "@implementation " << name << endl
-      << endl << "- (id) initWithProtocolFactory: (id <TProtocolFactory>) aProtocolFactory "
-                 "transportFactory: (id <TAsyncTransportFactory>) aTransportFactory;" << endl;
-
-  scope_up(out);
-  out << indent() << "self = [super init];" << endl;
-  out << indent() << "if (self) {" << endl;
-  out << indent() << "  protocolFactory = aProtocolFactory;" << endl;
-  out << indent() << "  transportFactory = aTransportFactory;" << endl;
-  out << indent() << "}" << endl;
-  out << indent() << "return self;" << endl;
-  scope_down(out);
-  out << endl;
-
-  // generate client method implementations
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
-    generate_cocoa_service_client_send_function_implementation(out, tservice, *f_iter, true);
-
-    if (!(*f_iter)->is_oneway()) {
-      generate_cocoa_service_client_recv_function_implementation(out, tservice, *f_iter, true);
-    }
-
-    // Open function
-    indent(out) << "- " << async_function_signature(*f_iter, false) << endl;
-    scope_up(out);
-
-    out << indent() << "NSError *thriftError;" << endl
-        << indent() << "id<TAsyncTransport> transport = [transportFactory newTransport];" << endl
-        << indent() << "id<TProtocol> protocol = [protocolFactory newProtocolOnTransport:transport];" << endl
-        << endl;
-
-    generate_cocoa_service_client_send_async_function_invocation(out, *f_iter, "failureBlock");
-
-    out << indent() << "[transport flushWithCompletion:^{" << endl;
-    indent_up();
-
-    if (!(*f_iter)->is_oneway()) {
-      out << indent() << "NSError *thriftError;" << endl;
-
-      if (!(*f_iter)->get_returntype()->is_void()) {
-        out << indent() << type_name((*f_iter)->get_returntype()) << " result;" << endl;
-      }
-      out << indent() << "if (![self recv_" << (*f_iter)->get_name();
-      if (!(*f_iter)->get_returntype()->is_void()) {
-        out << ": &result protocol";
-      }
-      out << ": protocol error: &thriftError]) ";
-      scope_up(out);
-      out << indent() << "failureBlock(thriftError);" << endl
-          << indent() << "return;" << endl;
-      scope_down(out);
-    }
-
-    out << indent() << "responseBlock(";
-    if (!(*f_iter)->is_oneway() && !(*f_iter)->get_returntype()->is_void()) {
-      out << "result";
-    }
-    out << ");" << endl;
-
-    indent_down();
-
-    out << indent() << "} failure:failureBlock];" << endl;
-
-    scope_down(out);
-
-    out << endl;
-
-    // Promise function
-    if (promise_kit_) {
-
-      indent(out) << "- " << promise_function_signature(*f_iter) << endl;
-      scope_up(out);
-
-      out << indent() << "return [AnyPromise promiseWithResolverBlock:^(PMKResolver resolver) {" << endl;
-      indent_up();
-
-      out << indent() << "NSError *thriftError;" << endl
-          << indent() << "id<TAsyncTransport> transport = [transportFactory newTransport];" << endl
-          << indent() << "id<TProtocol> protocol = [protocolFactory newProtocolOnTransport:transport];" << endl
-          << endl;
-
-      generate_cocoa_service_client_send_async_function_invocation(out, *f_iter, "resolver");
-
-      out << indent() << "[transport flushWithCompletion:^{" << endl;
-      indent_up();
-
-      if (!(*f_iter)->is_oneway()) {
-        out << indent() << "NSError *thriftError;" << endl;
-
-        if (!(*f_iter)->get_returntype()->is_void()) {
-          out << indent() << type_name((*f_iter)->get_returntype()) << " result;" << endl;
-        }
-        out << indent() << "if (![self recv_" << (*f_iter)->get_name();
-        if (!(*f_iter)->get_returntype()->is_void()) {
-          out << ": &result protocol";
-        }
-        out << ": protocol error: &thriftError]) ";
-        scope_up(out);
-        out << indent() << "resolver(thriftError);" << endl
-            << indent() << "return;" << endl;
-        scope_down(out);
-      }
-
-      out << indent() << "resolver(";
-      if ((*f_iter)->is_oneway() || (*f_iter)->get_returntype()->is_void()) {
-        out << "@YES";
-      } else if (type_can_be_null((*f_iter)->get_returntype())) {
-        out << "result";
-      } else {
-        out << "@(result)";
-      }
-      out << ");" << endl;
-
-      indent_down();
-
-      out << indent() << "} failure:^(NSError *error) {" << endl;
-      indent_up();
-      out << indent() << "resolver(error);" << endl;
-      indent_down();
-      out << indent() << "}];" << endl;
-
-      indent_down();
-      out << indent() << "}];" << endl;
-
-      scope_down(out);
-
-      out << endl;
-
-    }
-
-  }
-
-  out << "@end" << endl << endl;
-}
-
-/**
- * Generates a service server implementation.  In other words the actual TProcessor implementation
- * for the service.
- *
- * @param tservice The service to generate an implementation for
- */
-void t_cocoa_generator::generate_cocoa_service_server_implementation(ostream& out,
-                                                                     t_service* tservice) {
-
-  string name = cocoa_prefix_ + tservice->get_name() + "Processor";
-
-  out << "@interface " << name << " () ";
-
-  scope_up(out);
-  out << indent() << "id <" << cocoa_prefix_ << tservice->get_name() << "> service;" << endl;
-  out << indent() << "NSDictionary * methodMap;" << endl;
-  scope_down(out);
-
-  out << "@end" << endl << endl;
-
-  out << "@implementation " << name << endl;
-
-  // initializer
-  out << endl;
-  out << "- (id) initWith" << tservice->get_name() << ": (id <" << cocoa_prefix_ << tservice->get_name() << ">) aService" << endl;
-  scope_up(out);
-  out << indent() << "self = [super init];" << endl;
-  out << indent() << "if (self) ";
-  scope_up(out);
-  out << indent() << "service = aService;" << endl;
-  out << indent() << "methodMap = [NSMutableDictionary dictionary];" << endl;
-
-  // generate method map for routing incoming calls
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    string funname = (*f_iter)->get_name();
-    scope_up(out);
-    out << indent() << "SEL s = @selector(process_" << funname << "_withSequenceID:inProtocol:outProtocol:error:);" << endl;
-    out << indent() << "NSMethodSignature * sig = [self methodSignatureForSelector: s];" << endl;
-    out << indent() << "NSInvocation * invocation = [NSInvocation invocationWithMethodSignature: sig];" << endl;
-    out << indent() << "[invocation setSelector: s];" << endl;
-    out << indent() << "[invocation retainArguments];" << endl;
-    out << indent() << "[methodMap setValue: invocation forKey: @\"" << funname << "\"];" << endl;
-    scope_down(out);
-  }
-  scope_down(out);
-  out << indent() << "return self;" << endl;
-  scope_down(out);
-
-  // implementation of the 'service' method which returns the service associated with this
-  // processor
-  out << endl;
-  out << indent() << "- (id<" << cocoa_prefix_ << tservice->get_name() << ">) service" << endl;
-  out << indent() << "{" << endl;
-  out << indent() << "  return service;" << endl;
-  out << indent() << "}" << endl;
-
-  // implementation of the TProcess method, which dispatches the incoming call using the method map
-  out << endl;
-  out << indent() << "- (BOOL) processOnInputProtocol: (id <TProtocol>) inProtocol" << endl;
-  out << indent() << "                 outputProtocol: (id <TProtocol>) outProtocol" << endl;
-  out << indent() << "                          error: (NSError *__autoreleasing *)__thriftError" << endl;
-  out << indent() << "{" << endl;
-  out << indent() << "  NSString * messageName;" << endl;
-  out << indent() << "  SInt32 messageType;" << endl;
-  out << indent() << "  SInt32 seqID;" << endl;
-  out << indent() << "  if (![inProtocol readMessageBeginReturningName: &messageName" << endl;
-  out << indent() << "                                       type: &messageType" << endl;
-  out << indent() << "                                 sequenceID: &seqID" << endl;
-  out << indent() << "                                      error: __thriftError]) return NO;" << endl;
-  out << indent() << "  NSInvocation * invocation = [methodMap valueForKey: messageName];" << endl;
-  out << indent() << "  if (invocation == nil) {" << endl;
-  out << indent() << "    if (![TProtocolUtil skipType: TTypeSTRUCT onProtocol: inProtocol error: __thriftError]) return NO;" << endl;
-  out << indent() << "    if (![inProtocol readMessageEnd: __thriftError]) return NO;" << endl;
-  out << indent() << "    NSError * x = [NSError errorWithDomain: TApplicationErrorDomain" << endl;
-  out << indent() << "                                      code: TApplicationErrorUnknownMethod" << endl;
-  out << indent() << "                                  userInfo: @{TApplicationErrorMethodKey: messageName}];" << endl;
-  out << indent() << "    if (![outProtocol writeMessageBeginWithName: messageName" << endl;
-  out << indent() << "                                           type: TMessageTypeEXCEPTION" << endl;
-  out << indent() << "                                     sequenceID: seqID" << endl;
-  out << indent() << "                                          error: __thriftError]) return NO;" << endl;
-  out << indent() << "    if (![x write: outProtocol error: __thriftError]) return NO;" << endl;
-  out << indent() << "    if (![outProtocol writeMessageEnd: __thriftError]) return NO;" << endl;
-  out << indent() << "    if (![[outProtocol transport] flush: __thriftError]) return NO;" << endl;
-  out << indent() << "    return YES;" << endl;
-  out << indent() << "  }" << endl;
-  out << indent() << "  // NSInvocation does not conform to NSCopying protocol" << endl;
-  out << indent() << "  NSInvocation * i = [NSInvocation invocationWithMethodSignature: "
-                     "[invocation methodSignature]];" << endl;
-  out << indent() << "  [i setSelector: [invocation selector]];" << endl;
-  out << indent() << "  [i setArgument: &seqID atIndex: 2];" << endl;
-  out << indent() << "  [i setArgument: &inProtocol atIndex: 3];" << endl;
-  out << indent() << "  [i setArgument: &outProtocol atIndex: 4];" << endl;
-  out << indent() << "  [i setArgument: &__thriftError atIndex: 5];" << endl;
-  out << indent() << "  [i setTarget: self];" << endl;
-  out << indent() << "  [i invoke];" << endl;
-  out << indent() << "  return YES;" << endl;
-  out << indent() << "}" << endl;
-
-  // generate a process_XXXX method for each service function, which reads args, calls the service,
-  // and writes results
-  functions = tservice->get_functions();
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    out << endl;
-    string funname = (*f_iter)->get_name();
-    out << indent() << "- (BOOL) process_" << funname
-        << "_withSequenceID: (SInt32) seqID inProtocol: (id<TProtocol>) inProtocol outProtocol: "
-           "(id<TProtocol>) outProtocol error:(NSError *__autoreleasing *)__thriftError" << endl;
-    scope_up(out);
-    string argstype = cocoa_prefix_ + function_args_helper_struct_type(tservice, *f_iter);
-    out << indent() << argstype << " * args = [" << argstype << " new];" << endl;
-    out << indent() << "if (![args read: inProtocol error: __thriftError]) return NO;" << endl;
-    out << indent() << "if (![inProtocol readMessageEnd: __thriftError]) return NO;" << endl;
-
-    // prepare the result if not oneway
-    if (!(*f_iter)->is_oneway()) {
-      string resulttype = cocoa_prefix_ + function_result_helper_struct_type(tservice, *f_iter);
-      out << indent() << resulttype << " * result = [" << resulttype << " new];" << endl;
-    }
-
-    // make the call to the actual service object
-    out << indent();
-    if ((*f_iter)->get_returntype()->is_void()) {
-      out << "BOOL";
-    } else if (type_can_be_null((*f_iter)->get_returntype())) {
-      out << type_name((*f_iter)->get_returntype(), false, true);
-    } else {
-      out << "NSNumber *";
-    }
-    out << " serviceResult = ";
-    if ((*f_iter)->get_returntype()->get_true_type()->is_container()) {
-      out << "(" << type_name((*f_iter)->get_returntype(), false, true) << ")";
-    }
-    out << "[service " << funname;
-    // supplying arguments
-    t_struct* arg_struct = (*f_iter)->get_arglist();
-    const vector<t_field*>& fields = arg_struct->get_members();
-    vector<t_field*>::const_iterator fld_iter;
-    bool first = true;
-    for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
-      string fieldName = (*fld_iter)->get_name();
-      if (first) {
-        first = false;
-        out << ": [args " << fieldName << "]";
-      } else {
-        out << " " << fieldName << ": [args " << fieldName << "]";
-      }
-    }
-    if (!fields.empty()) {
-      out << " error";
-    }
-    out << ": __thriftError];" << endl;
-    out << indent() << "if (!serviceResult) return NO;" << endl;
-    if (!(*f_iter)->get_returntype()->is_void()) {
-      out << indent() << "[result setSuccess: " << unbox((*f_iter)->get_returntype(), "serviceResult") << "];" << endl;
-    }
-
-    // write out the result if not oneway
-    if (!(*f_iter)->is_oneway()) {
-      out << indent() << "if (![outProtocol writeMessageBeginWithName: @\"" << funname << "\"" << endl;
-      out << indent() << "                                       type: TMessageTypeREPLY" << endl;
-      out << indent() << "                                 sequenceID: seqID" << endl;
-      out << indent() << "                                      error: __thriftError]) return NO;" << endl;
-      out << indent() << "if (![result write: outProtocol error: __thriftError]) return NO;" << endl;
-      out << indent() << "if (![outProtocol writeMessageEnd: __thriftError]) return NO;" << endl;
-      out << indent() << "if (![[outProtocol transport] flush: __thriftError]) return NO;" << endl;
-    }
-    out << indent() << "return YES;" << endl;
-
-    scope_down(out);
-  }
-
-  out << "@end" << endl << endl;
-}
-
-/**
- * Deserializes a field of any type.
- *
- * @param tfield The field
- * @param fieldName The variable name for this field
- */
-void t_cocoa_generator::generate_deserialize_field(ostream& out,
-                                                   t_field* tfield,
-                                                   string fieldName) {
-  t_type* type = get_true_type(tfield->get_type());
-
-  if (type->is_void()) {
-    throw "CANNOT GENERATE DESERIALIZE CODE FOR void TYPE: " + tfield->get_name();
-  }
-
-  if (type->is_struct() || type->is_xception()) {
-    generate_deserialize_struct(out, (t_struct*)type, fieldName);
-  } else if (type->is_container()) {
-    generate_deserialize_container(out, type, fieldName);
-  } else if (type->is_base_type() || type->is_enum()) {
-    indent(out) << type_name(type) << " " << fieldName << ";" << endl;
-    indent(out) << "if (![inProtocol ";
-
-    if (type->is_base_type()) {
-      t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-      switch (tbase) {
-      case t_base_type::TYPE_VOID:
-        throw "compiler error: cannot serialize void field in a struct: " + tfield->get_name();
-        break;
-      case t_base_type::TYPE_STRING:
-        if (type->is_binary()) {
-          out << "readBinary:&" << fieldName << " error: __thriftError]";
-        } else {
-          out << "readString:&" << fieldName << " error: __thriftError]";
-        }
-        break;
-      case t_base_type::TYPE_BOOL:
-        out << "readBool:&" << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I8:
-        out << "readByte:(UInt8 *)&" << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I16:
-        out << "readI16:&" << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I32:
-        out << "readI32:&" << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I64:
-        out << "readI64:&" << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_DOUBLE:
-        out << "readDouble:&" << fieldName << " error: __thriftError]";
-        break;
-      default:
-        throw "compiler error: no Objective-C name for base type "
-            + t_base_type::t_base_name(tbase);
-      }
-    } else if (type->is_enum()) {
-      out << "readI32:&" << fieldName << " error: __thriftError]";
-    }
-    out << ") return NO;" << endl;
-  } else {
-    printf("DO NOT KNOW HOW TO DESERIALIZE FIELD '%s' TYPE '%s'\n",
-           tfield->get_name().c_str(),
-           type_name(type).c_str());
-  }
-}
-
-/**
- * Generates an unserializer for a struct, allocates the struct and invokes read:
- */
-void t_cocoa_generator::generate_deserialize_struct(ostream& out,
-                                                    t_struct* tstruct,
-                                                    string fieldName) {
-  indent(out) << type_name(tstruct) << fieldName << " = [[" << type_name(tstruct, true)
-              << " alloc] init];" << endl;
-  indent(out) << "if (![" << fieldName << " read: inProtocol error: __thriftError]) return NO;" << endl;
-}
-
-/**
- * Deserializes a container by reading its size and then iterating
- */
-void t_cocoa_generator::generate_deserialize_container(ostream& out,
-                                                       t_type* ttype,
-                                                       string fieldName) {
-  string size = tmp("_size");
-  indent(out) << "SInt32 " << size << ";" << endl;
-
-  // Declare variables, read header
-  if (ttype->is_map()) {
-    indent(out) << "if (![inProtocol readMapBeginReturningKeyType: NULL valueType: NULL size: &" << size << " error: __thriftError]) return NO;" << endl;
-    indent(out) << "NSMutableDictionary * " << fieldName
-                << " = [[NSMutableDictionary alloc] initWithCapacity: " << size << "];" << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "if (![inProtocol readSetBeginReturningElementType: NULL size: &" << size << " error: __thriftError]) return NO;"
-                << endl;
-    indent(out) << "NSMutableSet * " << fieldName
-                << " = [[NSMutableSet alloc] initWithCapacity: " << size << "];" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "if (![inProtocol readListBeginReturningElementType: NULL size: &" << size << " error: __thriftError]) return NO;"
-                << endl;
-    indent(out) << "NSMutableArray * " << fieldName
-                << " = [[NSMutableArray alloc] initWithCapacity: " << size << "];" << endl;
-  }
-  // FIXME - the code above does not verify that the element types of
-  // the containers being read match the element types of the
-  // containers we are reading into.  Does that matter?
-
-  // For loop iterates over elements
-  string i = tmp("_i");
-  indent(out) << "int " << i << ";" << endl << indent() << "for (" << i << " = 0; " << i << " < "
-              << size << "; "
-              << "++" << i << ")" << endl;
-
-  scope_up(out);
-
-  if (ttype->is_map()) {
-    generate_deserialize_map_element(out, (t_map*)ttype, fieldName);
-  } else if (ttype->is_set()) {
-    generate_deserialize_set_element(out, (t_set*)ttype, fieldName);
-  } else if (ttype->is_list()) {
-    generate_deserialize_list_element(out, (t_list*)ttype, fieldName);
-  }
-
-  scope_down(out);
-
-  // Read container end
-  if (ttype->is_map()) {
-    indent(out) << "if (![inProtocol readMapEnd: __thriftError]) return NO;" << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "if (![inProtocol readSetEnd: __thriftError]) return NO;" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "if (![inProtocol readListEnd: __thriftError]) return NO;" << endl;
-  }
-}
-
-/**
- * Take a variable of a given type and wrap it in code to make it
- * suitable for putting into a container, if necessary.  Basically,
- * wrap scaler primitives in NSNumber objects.
- */
-string t_cocoa_generator::box(t_type* ttype, string field_name) {
-
-  ttype = get_true_type(ttype);
-  if (ttype->is_enum()) {
-    return "@(" + field_name + ")";
-  } else if (ttype->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)ttype)->get_base();
-    switch (tbase) {
-      case t_base_type::TYPE_VOID:
-        throw "can't box void";
-      case t_base_type::TYPE_BOOL:
-      case t_base_type::TYPE_I8:
-      case t_base_type::TYPE_I16:
-      case t_base_type::TYPE_I32:
-      case t_base_type::TYPE_I64:
-      case t_base_type::TYPE_DOUBLE:
-        return "@(" + field_name + ")";
-      default:
-        break;
-    }
-  }
-
-  // do nothing
-  return field_name;
-}
-
-/**
- * Extracts the actual value from a boxed value
- */
-string t_cocoa_generator::unbox(t_type* ttype, string field_name) {
-  ttype = get_true_type(ttype);
-  if (ttype->is_enum()) {
-    return "[" + field_name + " intValue]";
-  } else if (ttype->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)ttype)->get_base();
-    switch (tbase) {
-      case t_base_type::TYPE_VOID:
-        throw "can't unbox void";
-      case t_base_type::TYPE_BOOL:
-        return "[" + field_name + " boolValue]";
-      case t_base_type::TYPE_I8:
-        return "((SInt8)[" + field_name + " charValue])";
-      case t_base_type::TYPE_I16:
-        return "((SInt16)[" + field_name + " shortValue])";
-      case t_base_type::TYPE_I32:
-        return "((SInt32)[" + field_name + " longValue])";
-      case t_base_type::TYPE_I64:
-        return "((SInt64)[" + field_name + " longLongValue])";
-      case t_base_type::TYPE_DOUBLE:
-        return "[" + field_name + " doubleValue]";
-      default:
-        break;
-    }
-  }
-
-  // do nothing
-  return field_name;
-}
-
-/**
- * Generates code to deserialize a map element
- */
-void t_cocoa_generator::generate_deserialize_map_element(ostream& out,
-                                                         t_map* tmap,
-                                                         string fieldName) {
-  string key = tmp("_key");
-  string val = tmp("_val");
-  t_type* keyType = tmap->get_key_type();
-  t_type* valType = tmap->get_val_type();
-  t_field fkey(keyType, key);
-  t_field fval(valType, val);
-
-  generate_deserialize_field(out, &fkey, key);
-  generate_deserialize_field(out, &fval, val);
-
-  indent(out) << "[" << fieldName << " setObject: " << box(valType, val)
-              << " forKey: " << box(keyType, key) << "];" << endl;
-}
-
-/**
- * Deserializes a set element
- */
-void t_cocoa_generator::generate_deserialize_set_element(ostream& out,
-                                                         t_set* tset,
-                                                         string fieldName) {
-  string elem = tmp("_elem");
-  t_type* type = tset->get_elem_type();
-  t_field felem(type, elem);
-
-  generate_deserialize_field(out, &felem, elem);
-
-  indent(out) << "[" << fieldName << " addObject: " << box(type, elem) << "];" << endl;
-}
-
-/**
- * Deserializes a list element
- */
-void t_cocoa_generator::generate_deserialize_list_element(ostream& out,
-                                                          t_list* tlist,
-                                                          string fieldName) {
-  string elem = tmp("_elem");
-  t_type* type = tlist->get_elem_type();
-  t_field felem(type, elem);
-
-  generate_deserialize_field(out, &felem, elem);
-
-  indent(out) << "[" << fieldName << " addObject: " << box(type, elem) << "];" << endl;
-}
-
-/**
- * Serializes a field of any type.
- *
- * @param tfield The field to serialize
- * @param fieldName Name to of the variable holding the field
- */
-void t_cocoa_generator::generate_serialize_field(ostream& out, t_field* tfield, string fieldName) {
-  t_type* type = get_true_type(tfield->get_type());
-
-  // Do nothing for void types
-  if (type->is_void()) {
-    throw "CANNOT GENERATE SERIALIZE CODE FOR void TYPE: " + tfield->get_name();
-  }
-
-  if (type->is_struct() || type->is_xception()) {
-    generate_serialize_struct(out, (t_struct*)type, fieldName);
-  } else if (type->is_container()) {
-    generate_serialize_container(out, type, fieldName);
-  } else if (type->is_base_type() || type->is_enum()) {
-    indent(out) << "if (![outProtocol ";
-
-    if (type->is_base_type()) {
-      t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-      switch (tbase) {
-      case t_base_type::TYPE_VOID:
-        throw "compiler error: cannot serialize void field in a struct: " + fieldName;
-        break;
-      case t_base_type::TYPE_STRING:
-        if (type->is_binary()) {
-          out << "writeBinary: " << fieldName << " error: __thriftError]";
-        } else {
-          out << "writeString: " << fieldName << " error: __thriftError]";
-        }
-        break;
-      case t_base_type::TYPE_BOOL:
-        out << "writeBool: " << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I8:
-        out << "writeByte: (UInt8)" << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I16:
-        out << "writeI16: " << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I32:
-        out << "writeI32: " << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_I64:
-        out << "writeI64: " << fieldName << " error: __thriftError]";
-        break;
-      case t_base_type::TYPE_DOUBLE:
-        out << "writeDouble: " << fieldName << " error: __thriftError]";
-        break;
-      default:
-        throw "compiler error: no Objective-C name for base type "
-            + t_base_type::t_base_name(tbase);
-      }
-    } else if (type->is_enum()) {
-      out << "writeI32: " << fieldName << " error: __thriftError]";
-    }
-    out << ") return NO;" << endl;
-  } else {
-    printf("DO NOT KNOW HOW TO SERIALIZE FIELD '%s' TYPE '%s'\n",
-           tfield->get_name().c_str(),
-           type_name(type).c_str());
-  }
-}
-
-/**
- * Serialize a struct.
- *
- * @param tstruct The struct to serialize
- * @param fieldName Name of variable holding struct
- */
-void t_cocoa_generator::generate_serialize_struct(ostream& out,
-                                                  t_struct* tstruct,
-                                                  string fieldName) {
-  (void)tstruct;
-  out << indent() << "if (![" << fieldName << " write: outProtocol error: __thriftError]) return NO;" << endl;
-}
-
-/**
- * Serializes a container by writing its size then the elements.
- *
- * @param ttype  The type of container
- * @param fieldName Name of variable holding container
- */
-void t_cocoa_generator::generate_serialize_container(ostream& out,
-                                                     t_type* ttype,
-                                                     string fieldName) {
-  scope_up(out);
-
-  if (ttype->is_map()) {
-    indent(out) << "if (![outProtocol writeMapBeginWithKeyType: "
-                << type_to_enum(((t_map*)ttype)->get_key_type())
-                << " valueType: " << type_to_enum(((t_map*)ttype)->get_val_type()) << " size: (SInt32)["
-                << fieldName << " count] error: __thriftError]) return NO;" << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "if (![outProtocol writeSetBeginWithElementType: "
-                << type_to_enum(((t_set*)ttype)->get_elem_type()) << " size: (SInt32)[" << fieldName
-                << " count] error: __thriftError]) return NO;" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "if (![outProtocol writeListBeginWithElementType: "
-                << type_to_enum(((t_list*)ttype)->get_elem_type()) << " size: (SInt32)[" << fieldName
-                << " count] error: __thriftError]) return NO;" << endl;
-  }
-
-  string iter = tmp("_iter");
-  string key;
-  if (ttype->is_map()) {
-    key = tmp("key");
-    indent(out) << "NSEnumerator * " << iter << " = [" << fieldName << " keyEnumerator];" << endl;
-    indent(out) << "id " << key << ";" << endl;
-    indent(out) << "while ((" << key << " = [" << iter << " nextObject]))" << endl;
-  } else if (ttype->is_set()) {
-    key = tmp("obj");
-    indent(out) << "NSEnumerator * " << iter << " = [" << fieldName << " objectEnumerator];"
-                << endl;
-    indent(out) << "id " << key << ";" << endl;
-    indent(out) << "while ((" << key << " = [" << iter << " nextObject]))" << endl;
-  } else if (ttype->is_list()) {
-    key = tmp("idx");
-    indent(out) << "int " << key << ";" << endl;
-    indent(out) << "for (" << key << " = 0; " << key << " < [" << fieldName << " count]; " << key
-                << "++)" << endl;
-  }
-
-  scope_up(out);
-
-  if (ttype->is_map()) {
-    generate_serialize_map_element(out, (t_map*)ttype, key, fieldName);
-  } else if (ttype->is_set()) {
-    generate_serialize_set_element(out, (t_set*)ttype, key);
-  } else if (ttype->is_list()) {
-    generate_serialize_list_element(out, (t_list*)ttype, key, fieldName);
-  }
-
-  scope_down(out);
-
-  if (ttype->is_map()) {
-    indent(out) << "if (![outProtocol writeMapEnd: __thriftError]) return NO;" << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "if (![outProtocol writeSetEnd: __thriftError]) return NO;" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "if (![outProtocol writeListEnd: __thriftError]) return NO;" << endl;
-  }
-
-  scope_down(out);
-}
-
-/**
- * Serializes the members of a map.
- */
-void t_cocoa_generator::generate_serialize_map_element(ostream& out,
-                                                       t_map* tmap,
-                                                       string key,
-                                                       string mapName) {
-  t_field kfield(tmap->get_key_type(), key);
-  generate_serialize_field(out, &kfield, unbox(kfield.get_type(), key));
-  t_field vfield(tmap->get_val_type(), "[" + mapName + " objectForKey: " + key + "]");
-  generate_serialize_field(out, &vfield, unbox(vfield.get_type(), vfield.get_name()));
-}
-
-/**
- * Serializes the members of a set.
- */
-void t_cocoa_generator::generate_serialize_set_element(ostream& out,
-                                                       t_set* tset,
-                                                       string elementName) {
-  t_field efield(tset->get_elem_type(), elementName);
-  generate_serialize_field(out, &efield, unbox(efield.get_type(), elementName));
-}
-
-/**
- * Serializes the members of a list.
- */
-void t_cocoa_generator::generate_serialize_list_element(ostream& out,
-                                                        t_list* tlist,
-                                                        string index,
-                                                        string listName) {
-  t_field efield(tlist->get_elem_type(), "[" + listName + " objectAtIndex: " + index + "]");
-  generate_serialize_field(out, &efield, unbox(efield.get_type(), efield.get_name()));
-}
-
-/**
- * Returns an Objective-C name
- *
- * @param ttype The type
- * @param class_ref Do we want a Class reference istead of a type reference?
- * @return Objective-C type name, i.e. NSDictionary<Key,Value> *
- */
-string t_cocoa_generator::type_name(t_type* ttype, bool class_ref, bool needs_mutable) {
-  if (ttype->is_typedef()) {
-    string name = (needs_mutable && ttype->get_true_type()->is_container()) ? "Mutable" + ttype->get_name() : ttype->get_name();
-    t_program* program = ttype->get_program();
-    return program ? (program->get_namespace("cocoa") + name) : name;
-  }
-
-  string result;
-  if (ttype->is_base_type()) {
-    return base_type_name((t_base_type*)ttype);
-  } else if (ttype->is_enum()) {
-    return cocoa_prefix_ + ttype->get_name();
-  } else if (ttype->is_map()) {
-    t_map *map = (t_map *)ttype;
-    result = needs_mutable ? "NSMutableDictionary" : "NSDictionary";
-    result += "<" + element_type_name(map->get_key_type()) + ", " + element_type_name(map->get_val_type()) + ">";
-  } else if (ttype->is_set()) {
-    t_set *set = (t_set *)ttype;
-    result = needs_mutable ? "NSMutableSet" : "NSSet";
-    result += "<" + element_type_name(set->get_elem_type()) + ">";
-  } else if (ttype->is_list()) {
-    t_list *list = (t_list *)ttype;
-    result = needs_mutable ? "NSMutableArray" : "NSArray";
-    result += "<" + element_type_name(list->get_elem_type()) + ">";
-  } else {
-    // Check for prefix
-    t_program* program = ttype->get_program();
-    if (program != NULL) {
-      result = program->get_namespace("cocoa") + ttype->get_name();
-    } else {
-      result = ttype->get_name();
-    }
-  }
-
-  if (!class_ref) {
-    result += " *";
-  }
-  return result;
-}
-
-/**
- * Returns an Objective-C type name for container types
- *
- * @param ttype the type
- */
-string t_cocoa_generator::element_type_name(t_type* etype) {
-
-  t_type* ttype = etype->get_true_type();
-
-  if (etype->is_typedef() && type_can_be_null(ttype)) {
-    return type_name(etype);
-  }
-
-  string result;
-  if (ttype->is_base_type()) {
-    t_base_type* tbase = (t_base_type*)ttype;
-    switch (tbase->get_base()) {
-    case t_base_type::TYPE_STRING:
-      if (tbase->is_binary()) {
-        result = "NSData *";
-      }
-      else {
-        result = "NSString *";
-      }
-      break;
-    default:
-      result = "NSNumber *";
-      break;
-    }
-  } else if (ttype->is_enum()) {
-      result = "NSNumber *";
-  } else if (ttype->is_map()) {
-    t_map *map = (t_map *)ttype;
-    result = "NSDictionary<" + element_type_name(map->get_key_type()) + ", " + element_type_name(map->get_val_type()) + "> *";
-  } else if (ttype->is_set()) {
-    t_set *set = (t_set *)ttype;
-    result = "NSSet<" + element_type_name(set->get_elem_type()) + "> *";
-  } else if (ttype->is_list()) {
-    t_list *list = (t_list *)ttype;
-    result = "NSArray<" + element_type_name(list->get_elem_type()) + "> *";
-  } else if (ttype->is_struct() || ttype->is_xception()) {
-    result = cocoa_prefix_ + ttype->get_name() + " *";
-  }
-
-  return result;
-}
-
-/**
- * Returns the Objective-C type that corresponds to the thrift type.
- *
- * @param tbase The base type
- */
-string t_cocoa_generator::base_type_name(t_base_type* type) {
-  t_base_type::t_base tbase = type->get_base();
-
-  switch (tbase) {
-  case t_base_type::TYPE_VOID:
-    return "void";
-  case t_base_type::TYPE_STRING:
-    if (type->is_binary()) {
-      return "NSData *";
-    } else {
-      return "NSString *";
-    }
-  case t_base_type::TYPE_BOOL:
-    return "BOOL";
-  case t_base_type::TYPE_I8:
-    return "SInt8";
-  case t_base_type::TYPE_I16:
-    return "SInt16";
-  case t_base_type::TYPE_I32:
-    return "SInt32";
-  case t_base_type::TYPE_I64:
-    return "SInt64";
-  case t_base_type::TYPE_DOUBLE:
-    return "double";
-  default:
-    throw "compiler error: no Objective-C name for base type " + t_base_type::t_base_name(tbase);
-  }
-}
-
-/**
- * Prints the value of a constant with the given type. Note that type checking
- * is NOT performed in this function as it is always run beforehand using the
- * validate_types method in main.cc
- */
-void t_cocoa_generator::print_const_value(ostream& out,
-                                          string name,
-                                          t_type* type,
-                                          t_const_value* value,
-                                          bool defval) {
-  type = get_true_type(type);
-
-  if (type->is_base_type()) {
-    string v2 = render_const_value(out, type, value);
-    indent(out);
-    if (defval)
-      out << type_name(type) << " ";
-    out << name << " = " << v2 << ";" << endl << endl;
-  } else if (type->is_enum()) {
-    indent(out);
-    if (defval)
-      out << type_name(type) << " ";
-    out << name << " = " << render_const_value(out, type, value) << ";" << endl << endl;
-  } else if (type->is_struct() || type->is_xception()) {
-    indent(out);
-    const vector<t_field*>& fields = ((t_struct*)type)->get_members();
-    vector<t_field*>::const_iterator f_iter;
-    const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-    map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-    if (defval)
-      out << type_name(type) << " ";
-    out << name << " = [" << type_name(type, true) << " new];"
-        << endl;
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      t_type* field_type = NULL;
-      for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-        if ((*f_iter)->get_name() == v_iter->first->get_string()) {
-          field_type = (*f_iter)->get_type();
-        }
-      }
-      if (field_type == NULL) {
-        throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string();
-      }
-      string val = render_const_value(out, field_type, v_iter->second);
-      std::string cap_name = capitalize(v_iter->first->get_string());
-      indent(out) << "[" << name << " set" << cap_name << ":" << val << "];" << endl;
-    }
-  } else if (type->is_map()) {
-    ostringstream mapout;
-    indent(mapout);
-    t_type* ktype = ((t_map*)type)->get_key_type();
-    t_type* vtype = ((t_map*)type)->get_val_type();
-    const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-    map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-    if (defval)
-      mapout << type_name(type) << " ";
-    mapout << name << " = @{";
-    for (v_iter = val.begin(); v_iter != val.end();) {
-      mapout << render_const_value(out, ktype, v_iter->first, true) << ": "
-          << render_const_value(out, vtype, v_iter->second, true);
-      if (++v_iter != val.end()) {
-        mapout << ", ";
-      }
-    }
-    mapout << "}";
-    out << mapout.str();
-  } else if (type->is_list()) {
-    ostringstream listout;
-    indent(listout);
-    t_type* etype = ((t_list*)type)->get_elem_type();
-    const vector<t_const_value*>& val = value->get_list();
-    vector<t_const_value*>::const_iterator v_iter;
-    if (defval)
-      listout << type_name(type) << " ";
-    listout << name << " = @[";
-    for (v_iter = val.begin(); v_iter != val.end();) {
-      listout << render_const_value(out, etype, *v_iter, true);
-      if (++v_iter != val.end()) {
-        listout << ", ";
-      }
-    }
-    listout << "]";
-    out << listout.str();
-  } else if (type->is_set()) {
-    ostringstream setout;
-    indent(setout);
-    t_type* etype = ((t_set*)type)->get_elem_type();
-    const vector<t_const_value*>& val = value->get_list();
-    vector<t_const_value*>::const_iterator v_iter;
-    if (defval)
-      setout << type_name(type) << " ";
-    setout << name << " = [NSSet setWithArray:@[";
-    for (v_iter = val.begin(); v_iter != val.end();) {
-      setout << render_const_value(out, etype, *v_iter, true);
-      if (++v_iter != val.end()) {
-        setout << ", ";
-      }
-    }
-    setout << "]]";
-    out << setout.str();
-  } else {
-    throw "compiler error: no const of type " + type->get_name();
-  }
-}
-
-string t_cocoa_generator::render_const_value(ostream& out,
-                                             t_type* type,
-                                             t_const_value* value,
-                                             bool box_it) {
-  type = get_true_type(type);
-  std::ostringstream render;
-
-  if (type->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-    switch (tbase) {
-    case t_base_type::TYPE_STRING:
-      // We must handle binary constant but the syntax of IDL defines
-      // nothing about binary constant.
-      //   if type->is_binary())
-      //      // binary code
-      render << "@\"" << get_escaped_string(value) << '"';
-      break;
-    case t_base_type::TYPE_BOOL:
-      render << ((value->get_integer() > 0) ? "YES" : "NO");
-      break;
-    case t_base_type::TYPE_I8:
-    case t_base_type::TYPE_I16:
-    case t_base_type::TYPE_I32:
-    case t_base_type::TYPE_I64:
-      render << value->get_integer();
-      break;
-    case t_base_type::TYPE_DOUBLE:
-      if (value->get_type() == t_const_value::CV_INTEGER) {
-        render << value->get_integer();
-      } else {
-        render << value->get_double();
-      }
-      break;
-    default:
-      throw "compiler error: no const of base type " + t_base_type::t_base_name(tbase);
-    }
-  } else if (type->is_enum()) {
-    render << value->get_integer();
-  } else {
-    string t = tmp("tmp");
-    print_const_value(out, t, type, value, true);
-    out << ";" << endl;
-    render << t;
-  }
-
-  if (box_it) {
-    return box(type, render.str());
-  }
-  return render.str();
-}
-
-#if 0
-/**
-ORIGINAL
- * Spit out code that evaluates to the specified constant value.
- */
-string t_cocoa_generator::render_const_value(string name,
-                                             t_type* type,
-                                             t_const_value* value,
-                                             bool box_it) {
-  type = get_true_type(type);
-  std::ostringstream render;
-
-  if (type->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-    switch (tbase) {
-    case t_base_type::TYPE_STRING:
-      render << "@\"" << get_escaped_string(value) << '"';
-      break;
-    case t_base_type::TYPE_BOOL:
-      render << ((value->get_integer() > 0) ? "YES" : "NO");
-      break;
-    case t_base_type::TYPE_I8:
-    case t_base_type::TYPE_I16:
-    case t_base_type::TYPE_I32:
-    case t_base_type::TYPE_I64:
-      render << value->get_integer();
-      break;
-    case t_base_type::TYPE_DOUBLE:
-      if (value->get_type() == t_const_value::CV_INTEGER) {
-        render << value->get_integer();
-      } else {
-        render << value->get_double();
-      }
-      break;
-    default:
-      throw "compiler error: no const of base type " + t_base_type::t_base_name(tbase);
-    }
-  } else if (type->is_enum()) {
-    render << value->get_integer();
-  } else if (type->is_struct() || type->is_xception()) {
-    const vector<t_field*>& fields = ((t_struct*)type)->get_members();
-    vector<t_field*>::const_iterator f_iter;
-    const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-    map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-    if (val.size() > 0)
-      render << "[[" << type_name(type, true) << " alloc] initWith";
-    else
-      render << "[[" << type_name(type, true) << " alloc] init";
-    bool first = true;
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      // FIXME The generated code does not match with initWithXXX
-      //       initializer and causes compile error.
-      //       Try: test/DebugProtoTest.thrift and test/SmallTest.thrift
-      t_type* field_type = NULL;
-      for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-        if ((*f_iter)->get_name() == v_iter->first->get_string()) {
-          field_type = (*f_iter)->get_type();
-        }
-      }
-      if (field_type == NULL) {
-        throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string();
-      }
-      if (first) {
-        render << capitalize(v_iter->first->get_string());
-        first = false;
-      } else {
-        render << " " << v_iter->first->get_string();
-      }
-      render << ": " << render_const_value(name, field_type, v_iter->second);
-    }
-    render << "]";
-  } else if (type->is_map()) {
-    render << "[[NSDictionary alloc] initWithObjectsAndKeys: ";
-    t_type* ktype = ((t_map*)type)->get_key_type();
-    t_type* vtype = ((t_map*)type)->get_val_type();
-    const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-    map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-    bool first = true;
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      string key = render_const_value(name, ktype, v_iter->first, true);
-      string val = render_const_value(name, vtype, v_iter->second, true);
-      if (first) {
-        first = false;
-      } else {
-        render << ", ";
-      }
-      render << val << ", " << key;
-    }
-    if (first)
-      render << " nil]";
-    else
-      render << ", nil]";
-  } else if (type->is_list()) {
-    render << "[[NSArray alloc] initWithObjects: ";
-    t_type * etype = ((t_list*)type)->get_elem_type();
-    const vector<t_const_value*>& val = value->get_list();
-    bool first = true;
-    vector<t_const_value*>::const_iterator v_iter;
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      if (first) {
-        first = false;
-      } else {
-        render << ", ";
-      }
-      render << render_const_value(name, etype, *v_iter, true);
-    }
-    if (first)
-      render << " nil]";
-    else
-      render << ", nil]";
-  } else if (type->is_set()) {
-    render << "[[NSSet alloc] initWithObjects: ";
-    t_type * etype = ((t_set*)type)->get_elem_type();
-    const vector<t_const_value*>& val = value->get_list();
-    bool first = true;
-    vector<t_const_value*>::const_iterator v_iter;
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      if (first) {
-        first = false;
-      } else {
-        render << ", ";
-      }
-      render << render_const_value(name, etype, *v_iter, true);
-    }
-    if (first)
-      render << " nil]";
-    else
-      render << ", nil]";
-  } else {
-    throw "don't know how to render constant for type: " + type->get_name();
-  }
-
-  if (box_it) {
-    return box(type, render.str());
-  }
-
-  return render.str();
-}
-#endif
-
-/**
- * Declares an Objective-C 2.0 property.
- *
- * @param tfield The field to declare a property for
- */
-string t_cocoa_generator::declare_property(t_field* tfield) {
-  std::ostringstream render;
-  render << "@property (";
-
-  if (type_can_be_copy(tfield->get_type())) {
-    render << "copy, ";
-  } else if (type_can_be_null(tfield->get_type())) {
-    render << "strong, ";
-  } else {
-    render << "assign, ";
-  }
-
-  render << "nonatomic) " << type_name(tfield->get_type(), false, true) << " "
-  << tfield->get_name() << ";";
-
-  // Check if the property name is an Objective-C return +1 count signal
-  if ((tfield->get_name().length() >= 3 && tfield->get_name().substr(0,3) == "new") ||
-      (tfield->get_name().length() >= 6 && tfield->get_name().substr(0,6) == "create") ||
-      (tfield->get_name().length() >= 5 && tfield->get_name().substr(0,5) == "alloc")) {
-    // Let Objective-C know not to return +1 for object pointers
-    if (type_can_be_null(tfield->get_type())) {
-      render << endl;
-      render << "- (" + type_name(tfield->get_type()) + ") " + decapitalize(tfield->get_name()) + " __attribute__((objc_method_family(none)));";
-    }
-  }
-
-  return render.str();
-}
-
-/**
- * Declares an Objective-C 2.0 property.
- *
- * @param tfield The field to declare a property for
- */
-string t_cocoa_generator::declare_property_isset(t_field* tfield) {
-  return "@property (assign, nonatomic) BOOL " + decapitalize(tfield->get_name()) + "IsSet;";
-}
-
-/**
- * Declares property unset method.
- *
- * @param tfield The field to declare a property for
- */
-string t_cocoa_generator::declare_property_unset(t_field* tfield) {
-  return "- (void) unset" + capitalize(tfield->get_name()) + ";";
-}
-
-/**
- * Renders the early out return statement
- *
- * @param tfunction Function definition
- * @return String of rendered invalid return statment
- */
-string t_cocoa_generator::invalid_return_statement(t_function *tfunction) {
-  if ((tfunction->get_returntype()->is_void())) {
-    return "return NO;";
-  }
-  return "return nil;";
-}
-
-/**
- * Renders a function signature
- *
- * @param tfunction Function definition
- * @return String of rendered function definition
- */
-string t_cocoa_generator::function_signature(t_function* tfunction, bool include_error) {
-  t_type* ttype = tfunction->get_returntype();
-  string result;
-  if (ttype->is_void()) {
-    result = "(BOOL)";
-  }
-  else if (type_can_be_null(ttype)) {
-    result = "(" + type_name(ttype) + ")";
-  }
-  else {
-    result = "(NSNumber *)";
-  }
-  result += " " + tfunction->get_name() + argument_list(tfunction->get_arglist(), "", include_error);
-  return result;
-}
-
-/**
- * Renders a function signature that returns asynchronously instead of
- * literally returning.
- *
- * @param tfunction Function definition
- * @return String of rendered function definition
- */
-string t_cocoa_generator::async_function_signature(t_function* tfunction, bool include_error) {
-  t_type* ttype = tfunction->get_returntype();
-  t_struct* targlist = tfunction->get_arglist();
-  string response_param = "void (^)(" + ((ttype->is_void()) ? "" : type_name(ttype)) + ")";
-  std::string result = "(void) " + tfunction->get_name() + argument_list(tfunction->get_arglist(), "", include_error)
-  + (targlist->get_members().size() ? " response" : "") + ": ("
-  + response_param + ") responseBlock "
-  + "failure : (TAsyncFailureBlock) failureBlock";
-  return result;
-}
-
-/**
- * Renders a function signature that returns a promise instead of
- * literally returning.
- *
- * @param tfunction Function definition
- * @return String of rendered function definition
- */
-string t_cocoa_generator::promise_function_signature(t_function* tfunction) {
-  return "(AnyPromise *) " + tfunction->get_name() + argument_list(tfunction->get_arglist(), "", false);
-}
-
-/**
- * Renders a colon separated list of types and names, suitable for an
- * objective-c parameter list
- */
-string t_cocoa_generator::argument_list(t_struct* tstruct, string protocol_name, bool include_error) {
-  string result = "";
-  bool include_protocol = !protocol_name.empty();
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  bool first = true;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    string argPrefix = "";
-    if (first) {
-      first = false;
-    } else {
-      argPrefix = (*f_iter)->get_name();
-      result += " ";
-    }
-    result += argPrefix + ": (" + type_name((*f_iter)->get_type()) + ") " + (*f_iter)->get_name();
-  }
-  if (include_protocol) {
-    if (!first) {
-      result += " protocol";
-    }
-    result += ": (id<TProtocol>) " + protocol_name;
-    first = false;
-  }
-  if (include_error) {
-    if (!first) {
-      result += " error";
-    }
-    result += ": (NSError *__autoreleasing *)__thriftError";
-    first = false;
-  }
-  return result;
-}
-
-/**
- * Converts the parse type to an Objective-C enum string for the given type.
- */
-string t_cocoa_generator::type_to_enum(t_type* type) {
-  type = get_true_type(type);
-
-  if (type->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-    switch (tbase) {
-    case t_base_type::TYPE_VOID:
-      throw "NO T_VOID CONSTRUCT";
-    case t_base_type::TYPE_STRING:
-      return "TTypeSTRING";
-    case t_base_type::TYPE_BOOL:
-      return "TTypeBOOL";
-    case t_base_type::TYPE_I8:
-      return "TTypeBYTE";
-    case t_base_type::TYPE_I16:
-      return "TTypeI16";
-    case t_base_type::TYPE_I32:
-      return "TTypeI32";
-    case t_base_type::TYPE_I64:
-      return "TTypeI64";
-    case t_base_type::TYPE_DOUBLE:
-      return "TTypeDOUBLE";
-    }
-  } else if (type->is_enum()) {
-    return "TTypeI32";
-  } else if (type->is_struct() || type->is_xception()) {
-    return "TTypeSTRUCT";
-  } else if (type->is_map()) {
-    return "TTypeMAP";
-  } else if (type->is_set()) {
-    return "TTypeSET";
-  } else if (type->is_list()) {
-    return "TTypeLIST";
-  }
-
-  throw "INVALID TYPE IN type_to_enum: " + type->get_name();
-}
-
-/**
- * Returns a format string specifier for the supplied parse type.
- */
-string t_cocoa_generator::format_string_for_type(t_type* type) {
-  type = get_true_type(type);
-
-  if (type->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-    switch (tbase) {
-    case t_base_type::TYPE_VOID:
-      throw "NO T_VOID CONSTRUCT";
-    case t_base_type::TYPE_STRING:
-      return "\\\"%@\\\"";
-    case t_base_type::TYPE_BOOL:
-      return "%i";
-    case t_base_type::TYPE_I8:
-      return "%i";
-    case t_base_type::TYPE_I16:
-      return "%hi";
-    case t_base_type::TYPE_I32:
-      return "%i";
-    case t_base_type::TYPE_I64:
-      return "%qi";
-    case t_base_type::TYPE_DOUBLE:
-      return "%f";
-    }
-  } else if (type->is_enum()) {
-    return "%i";
-  } else if (type->is_struct() || type->is_xception()) {
-    return "%@";
-  } else if (type->is_map()) {
-    return "%@";
-  } else if (type->is_set()) {
-    return "%@";
-  } else if (type->is_list()) {
-    return "%@";
-  }
-
-  throw "INVALID TYPE IN format_string_for_type: " + type->get_name();
-}
-
-/**
- * Returns a format cast for the supplied parse type.
- */
-string t_cocoa_generator::format_cast_for_type(t_type* type) {
-  type = get_true_type(type);
-
-  if (type->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-    switch (tbase) {
-    case t_base_type::TYPE_VOID:
-      throw "NO T_VOID CONSTRUCT";
-    case t_base_type::TYPE_STRING:
-      return ""; // "\\\"%@\\\"";
-    case t_base_type::TYPE_BOOL:
-      return ""; // "%i";
-    case t_base_type::TYPE_I8:
-      return ""; // "%i";
-    case t_base_type::TYPE_I16:
-      return ""; // "%hi";
-    case t_base_type::TYPE_I32:
-      return "(int)"; // "%i";
-    case t_base_type::TYPE_I64:
-      return ""; // "%qi";
-    case t_base_type::TYPE_DOUBLE:
-      return ""; // "%f";
-    }
-  } else if (type->is_enum()) {
-    return "(int)"; // "%i";
-  } else if (type->is_struct() || type->is_xception()) {
-    return ""; // "%@";
-  } else if (type->is_map()) {
-    return ""; // "%@";
-  } else if (type->is_set()) {
-    return ""; // "%@";
-  } else if (type->is_list()) {
-    return ""; // "%@";
-  }
-
-  throw "INVALID TYPE IN format_cast_for_type: " + type->get_name();
-}
-
-/**
- * Generate a call to a field's setter.
- *
- * @param tfield Field the setter is being called on
- * @param fieldName Name of variable to pass to setter
- */
-
-string t_cocoa_generator::call_field_setter(t_field* tfield, string fieldName) {
-  return "self." + tfield->get_name() + " = " + fieldName + ";";
-}
-
-THRIFT_REGISTER_GENERATOR(
-    cocoa,
-    "Cocoa",
-    "    log_unexpected:  Log every time an unexpected field ID or type is encountered.\n"
-    "    debug_descriptions:\n"
-    "                     Allow use of debugDescription so the app can add description via a cateogory/extension\n"
-    "    validate_required:\n"
-    "                     Throws exception if any required field is not set.\n"
-    "    async_clients:   Generate clients which invoke asynchronously via block syntax.\n"
-    "    pods:            Generate imports in Cocopods framework format.\n"
-    "    promise_kit:     Generate clients which invoke asynchronously via promises.\n")
diff --git a/compiler/cpp/src/thrift/thriftl.ll b/compiler/cpp/src/thrift/thriftl.ll
index 4f783be..282e030 100644
--- a/compiler/cpp/src/thrift/thriftl.ll
+++ b/compiler/cpp/src/thrift/thriftl.ll
@@ -207,15 +207,14 @@
 "cpp_include"        { return tok_cpp_include;          }
 "cpp_type"           { return tok_cpp_type;             }
 "java_package"       { error_unsupported_namespace_decl("java_package", "java"); /* do nothing */ }
-"cocoa_prefix"       { error_unsupported_namespace_decl("cocoa_prefix", "cocoa"); /* do nothing */ }
 "csharp_namespace"   { error_unsupported_namespace_decl("csharp"); /* do nothing */ }
 "delphi_namespace"   { error_unsupported_namespace_decl("delphi"); /* do nothing */ }
 "php_namespace"      { error_unsupported_namespace_decl("php"); /* do nothing */ }
 "py_module"          { error_unsupported_namespace_decl("py_module", "py"); /* do nothing */ }
 "perl_package"       { error_unsupported_namespace_decl("perl_package", "perl"); /* do nothing */ }
 "ruby_namespace"     { error_unsupported_namespace_decl("ruby"); /* do nothing */ }
-"smalltalk_category" { error_unsupported_namespace_decl("smalltalk_category", "smalltalk.category"); /* do nothing */ }
-"smalltalk_prefix"   { error_unsupported_namespace_decl("smalltalk_category", "smalltalk.category"); /* do nothing */ }
+"smalltalk_category" { error_unsupported_namespace_decl("smalltalk_category", "st"); /* do nothing */ }
+"smalltalk_prefix"   { error_unsupported_namespace_decl("smalltalk_prefix", "st"); /* do nothing */ }
 "xsd_all"            { return tok_xsd_all;              }
 "xsd_optional"       { return tok_xsd_optional;         }
 "xsd_nillable"       { return tok_xsd_nillable;         }
diff --git a/compiler/cpp/tests/CMakeLists.txt b/compiler/cpp/tests/CMakeLists.txt
index e2b100c..fde9073 100644
--- a/compiler/cpp/tests/CMakeLists.txt
+++ b/compiler/cpp/tests/CMakeLists.txt
@@ -96,36 +96,36 @@
 endmacro()
 
 # The following compiler with unit tests can be enabled or disabled
-THRIFT_ADD_COMPILER(c_glib  "Enable compiler for C with Glib" OFF)
-THRIFT_ADD_COMPILER(cpp     "Enable compiler for C++" OFF)
-THRIFT_ADD_COMPILER(java    "Enable compiler for Java"   OFF)
 THRIFT_ADD_COMPILER(as3     "Enable compiler for ActionScript 3" OFF)
-THRIFT_ADD_COMPILER(dart    "Enable compiler for Dart" OFF)
-THRIFT_ADD_COMPILER(haxe    "Enable compiler for Haxe" OFF)
+THRIFT_ADD_COMPILER(c_glib  "Enable compiler for C with Glib" OFF)
+THRIFT_ADD_COMPILER(cl      "Enable compiler for Common LISP" OFF)
+THRIFT_ADD_COMPILER(cpp     "Enable compiler for C++" OFF)
 THRIFT_ADD_COMPILER(csharp  "Enable compiler for C#" OFF)
-THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
-THRIFT_ADD_COMPILER(py      "Enable compiler for Python 2.0" OFF)
-THRIFT_ADD_COMPILER(rb      "Enable compiler for Ruby" OFF)
-THRIFT_ADD_COMPILER(perl    "Enable compiler for Perl" OFF)
-THRIFT_ADD_COMPILER(php     "Enable compiler for PHP" OFF)
+THRIFT_ADD_COMPILER(d       "Enable compiler for D" OFF)
+THRIFT_ADD_COMPILER(dart    "Enable compiler for Dart" OFF)
+THRIFT_ADD_COMPILER(delphi  "Enable compiler for Delphi" OFF)
 THRIFT_ADD_COMPILER(erl     "Enable compiler for Erlang" OFF)
-THRIFT_ADD_COMPILER(cocoa   "Enable compiler for Cocoa Objective-C" OFF)
-THRIFT_ADD_COMPILER(swift   "Enable compiler for Cocoa Swift" OFF)
-THRIFT_ADD_COMPILER(st      "Enable compiler for Smalltalk" OFF)
-THRIFT_ADD_COMPILER(ocaml   "Enable compiler for OCaml" OFF)
+THRIFT_ADD_COMPILER(go      "Enable compiler for Go" OFF)
+THRIFT_ADD_COMPILER(gv      "Enable compiler for GraphViz" OFF)
+THRIFT_ADD_COMPILER(haxe    "Enable compiler for Haxe" OFF)
 THRIFT_ADD_COMPILER(hs      "Enable compiler for Haskell" OFF)
-THRIFT_ADD_COMPILER(xsd     "Enable compiler for XSD" OFF)
 THRIFT_ADD_COMPILER(html    "Enable compiler for HTML Documentation" OFF)
+THRIFT_ADD_COMPILER(java    "Enable compiler for Java"   OFF)
+THRIFT_ADD_COMPILER(javame  "Enable compiler for Java ME" OFF)
 THRIFT_ADD_COMPILER(js      "Enable compiler for JavaScript" OFF)
 THRIFT_ADD_COMPILER(json    "Enable compiler for JSON" OFF)
-THRIFT_ADD_COMPILER(javame  "Enable compiler for Java ME" OFF)
-THRIFT_ADD_COMPILER(delphi  "Enable compiler for Delphi" OFF)
-THRIFT_ADD_COMPILER(go      "Enable compiler for Go" OFF)
-THRIFT_ADD_COMPILER(d       "Enable compiler for D" OFF)
 THRIFT_ADD_COMPILER(lua     "Enable compiler for Lua" OFF)
-THRIFT_ADD_COMPILER(gv      "Enable compiler for GraphViz" OFF)
+THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
+THRIFT_ADD_COMPILER(ocaml   "Enable compiler for OCaml" OFF)
+THRIFT_ADD_COMPILER(perl    "Enable compiler for Perl" OFF)
+THRIFT_ADD_COMPILER(php     "Enable compiler for PHP" OFF)
+THRIFT_ADD_COMPILER(py      "Enable compiler for Python 2.0" OFF)
+THRIFT_ADD_COMPILER(rb      "Enable compiler for Ruby" OFF)
 THRIFT_ADD_COMPILER(rs      "Enable compiler for Rust" OFF)
+THRIFT_ADD_COMPILER(st      "Enable compiler for Smalltalk" OFF)
+THRIFT_ADD_COMPILER(swift   "Enable compiler for Swift" OFF)
 THRIFT_ADD_COMPILER(xml     "Enable compiler for XML" OFF)
+THRIFT_ADD_COMPILER(xsd     "Enable compiler for XSD" OFF)
 
 # Thrift is looking for include files in the src directory
 # we also add the current binary directory for generated files
@@ -150,4 +150,4 @@
 target_link_libraries(thrift_compiler_tests thrift_compiler)
 
 enable_testing()
-add_test(NAME ThriftTests COMMAND thrift_compiler_tests)
\ No newline at end of file
+add_test(NAME ThriftTests COMMAND thrift_compiler_tests)
diff --git a/contrib/thrift.spec b/contrib/thrift.spec
index cc3c33c..ffdfab2 100644
--- a/contrib/thrift.spec
+++ b/contrib/thrift.spec
@@ -58,8 +58,8 @@
 Thrift is a software framework for scalable cross-language services
 development. It combines a powerful software stack with a code generation
 engine to build services that work efficiently and seamlessly between C++,
-Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang,
-Objective Caml, and Haskell.
+Java, C#, Python, Ruby, Perl, PHP, Smalltalk, Erlang, OCaml, Haskell, and
+other languages.
 
 %files
 %defattr(-,root,root)
diff --git a/debian/copyright b/debian/copyright
index 850643c..3e6fcf7 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -28,7 +28,6 @@
 under the Apache 2.0 License:
 
   compiler/cpp/Makefile.am
-  compiler/cpp/src/generate/t_cocoa_generator.cc
   compiler/cpp/src/generate/t_cpp_generator.cc
   compiler/cpp/src/generate/t_csharp_generator.cc
   compiler/cpp/src/generate/t_erl_generator.cc
diff --git a/doap.rdf b/doap.rdf
index cb76fac..50b3491 100755
--- a/doap.rdf
+++ b/doap.rdf
@@ -27,7 +27,7 @@
     <name>Apache Thrift</name>
     <homepage rdf:resource="http://thrift.apache.org" />
     <asfext:pmc rdf:resource="http://thrift.apache.org" />
-    <shortdesc>Apache Thrift software provides a framework for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages. </shortdesc>
+    <shortdesc>Apache Thrift software provides a framework for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages. </shortdesc>
     <description>Apache Thrift allows you to define data types and service interfaces in a simple definition file. Taking that file as input, the compiler generates code to be used to easily build RPC clients and servers that communicate seamlessly across programming languages. Instead of writing a load of boilerplate code to serialize and transport your objects and invoke remote methods, you can get right down to business. </description>
     <bug-database rdf:resource="https://issues.apache.org/jira/browse/THRIFT" />
     <mailing-list rdf:resource="http://thrift.apache.org/mailing/" />
@@ -36,7 +36,6 @@
     <programming-language>C</programming-language>
     <programming-language>C#</programming-language>
     <programming-language>C++</programming-language>
-    <programming-language>Cocoa</programming-language>
     <programming-language>D</programming-language>
     <programming-language>Dart</programming-language>
     <programming-language>Delphi</programming-language>
diff --git a/doc/specs/idl.md b/doc/specs/idl.md
index bf22f54..069f2fc 100644
--- a/doc/specs/idl.md
+++ b/doc/specs/idl.md
@@ -1,10 +1,11 @@
 ## Thrift interface description language
+
+For Thrift version 1.0.0.
+
 The Thrift interface definition language (IDL) allows for the definition of [Thrift Types](/docs/types). A Thrift IDL file is processed by the Thrift code generator to produce code for the various target languages to support the defined structs and services in the IDL file.
 
 ## Description
 
-*Under construction*
-
 Here is a description of the Thrift IDL.
 
 ## Document
@@ -35,32 +36,9 @@
 
 A namespace declares which namespaces/package/module/etc. the type definitions in this file will be declared in for the target languages. The namespace scope indicates which language the namespace applies to; a scope of '*' indicates that the namespace applies to all target languages.
 
-    [5]  Namespace       ::=  ( 'namespace' ( NamespaceScope Identifier ) |
-                                            ( 'smalltalk.category' STIdentifier ) |
-                                            ( 'smalltalk.prefix' Identifier ) ) |
-                              ( 'php_namespace' Literal ) |
-                              ( 'xsd_namespace' Literal )
+    [5]  Namespace       ::=  ( 'namespace' ( NamespaceScope Identifier ) )
 
-    [6]  NamespaceScope  ::=  '*' | 'cpp' | 'java' | 'py' | 'perl' | 'rb' | 'cocoa' | 'csharp'
-
-N.B.: Smalltalk has two distinct types of namespace commands:
-
-- smalltalk.prefix: Prepended to generated classnames.
-  - Smalltalk does not have namespaces for classes, so prefixes
-    are used to avoid class-name collisions.
-    Often, the prefix is the author's initials, like "KB" or "JWS",
-    or an abbreviation of the package name, like "MC" for "Monticello".
-- smalltalk.category: Determines the category for generated classes.
-  Any dots in the identifier will be replaced with hyphens when generating
-  the category name.
-  If not provided, defaults to "Generated-" + the program name.
-  Methods will not be categorized beyond "as yet uncategorized".
-  - Smalltalk allows filing both classes and methods within classes into named
-    groups. These named groups of methods are called categories.
-
-N.B.: The `php_namespace` directive will be deprecated at some point in the future in favor of the scoped syntax, but the scoped syntax is not yet supported for PHP.
-
-N.B.: The `xsd_namespace` directive has some purpose internal to Facebook but serves no purpose in Thrift itself. Use of this feature is strongly discouraged
+    [6]  NamespaceScope  ::=  '*' | 'c_glib' | 'cpp' | 'csharp' | 'delphi' | 'go' | 'java' | 'js' | 'lua' | 'netcore' | 'perl' | 'php' | 'py' | 'py.twisted' | 'rb' | 'st' | 'xsd'
 
 ## Definition
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b6ce20e..0c69019 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -110,7 +110,6 @@
 # so they will end up in our release tarballs.
 EXTRA_DIST = \
 	as3 \
-	cocoa \
 	d \
 	dart \
 	delphi \
diff --git a/lib/cocoa/README.md b/lib/cocoa/README.md
deleted file mode 100644
index bbe3c93..0000000
--- a/lib/cocoa/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-Thrift Cocoa Software Library
-
-License
-=======
-
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
diff --git a/lib/cocoa/coding_standards.md b/lib/cocoa/coding_standards.md
deleted file mode 100644
index fa0390b..0000000
--- a/lib/cocoa/coding_standards.md
+++ /dev/null
@@ -1 +0,0 @@
-Please follow [General Coding Standards](/doc/coding_standards.md)
diff --git a/lib/cocoa/src/TApplicationError.h b/lib/cocoa/src/TApplicationError.h
deleted file mode 100644
index 079881a..0000000
--- a/lib/cocoa/src/TApplicationError.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-
-extern NSString *TApplicationErrorDomain;
-
-typedef NS_ENUM (int, TApplicationError) {
-  TApplicationErrorUnknown                = 0,
-  TApplicationErrorUnknownMethod          = 1,
-  TApplicationErrorInvalidMessageType     = 2,
-  TApplicationErrorWrongMethodName        = 3,
-  TApplicationErrorBadSequenceId          = 4,
-  TApplicationErrorMissingResult          = 5,
-  TApplicationErrorInternalError          = 6,
-  TApplicationErrorProtocolError          = 7,
-  TApplicationErrorInvalidTransform       = 8,
-  TApplicationErrorInvalidProtocol        = 9,
-  TApplicationErrorUnsupportedClientType  = 10,
-};
-
-
-extern NSString *TApplicationErrorNameKey;
-extern NSString *TApplicationErrorReasonKey;
-extern NSString *TApplicationErrorMethodKey;
-
-
-@interface NSError (TApplicationError)
-
-@property (readonly, copy) NSString *name;
-@property (readonly, copy) NSString *reason;
-
-+(instancetype) errorWithType:(TApplicationError)type reason:(NSString *)reason;
-
-+(instancetype) read:(id<TProtocol>)protocol;
-
--(BOOL) write:(id<TProtocol>)outProtocol error:(NSError *__autoreleasing *)error;
-
-@end
diff --git a/lib/cocoa/src/TApplicationError.m b/lib/cocoa/src/TApplicationError.m
deleted file mode 100644
index 080bc0b..0000000
--- a/lib/cocoa/src/TApplicationError.m
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TApplicationError.h"
-#import "TProtocolUtil.h"
-
-
-NSString *TApplicationErrorDomain = @"TApplicationErrorDomain";
-
-
-NSString *TApplicationErrorNameKey = @"name";
-NSString *TApplicationErrorReasonKey = @"reason";
-NSString *TApplicationErrorMethodKey = @"method";
-
-
-@implementation NSError (TApplicationError)
-
--(NSString *) reason
-{
-  return self.userInfo[TApplicationErrorReasonKey];
-}
-
--(NSString *) name
-{
-  return self.userInfo[TApplicationErrorNameKey];
-}
-
-+(instancetype) errorWithType:(TApplicationError)type reason:(NSString *)reason
-{
-  NSString *name;
-  switch (type) {
-  case TApplicationErrorUnknownMethod:
-    name = @"Unknown Method";
-    break;
-
-  case TApplicationErrorInvalidMessageType:
-    name = @"Invalid Message Type";
-    break;
-
-  case TApplicationErrorWrongMethodName:
-    name = @"Wrong Method Name";
-    break;
-
-  case TApplicationErrorBadSequenceId:
-    name = @"Bad Sequence ID";
-    break;
-
-  case TApplicationErrorMissingResult:
-    name = @"Missing Result";
-    break;
-
-  case TApplicationErrorInternalError:
-    name = @"Internal Error";
-    break;
-
-  case TApplicationErrorProtocolError:
-    name = @"Protocol Error";
-    break;
-
-  case TApplicationErrorInvalidTransform:
-    name = @"Invalid Transform";
-    break;
-
-  case TApplicationErrorInvalidProtocol:
-    name = @"Invalid Protocol";
-    break;
-
-  case TApplicationErrorUnsupportedClientType:
-    name = @"Unsupported Client Type";
-    break;
-
-  default:
-    name = @"Unknown";
-    break;
-  }
-
-  NSDictionary *userInfo;
-  if (reason) {
-    userInfo = @{TApplicationErrorNameKey:name,
-                 TApplicationErrorReasonKey:reason};
-  }
-  else {
-    userInfo = @{TApplicationErrorNameKey:name};
-  }
-
-  return [NSError errorWithDomain:TApplicationErrorDomain
-                             code:type
-                         userInfo:userInfo];
-}
-
-
-+(instancetype) read:(id<TProtocol>)protocol
-{
-  NSString *reason = nil;
-  SInt32 type = TApplicationErrorUnknown;
-  SInt32 fieldType;
-  SInt32 fieldID;
-
-  NSError *error;
-  if (![protocol readStructBeginReturningName:NULL error:&error]) {
-    return error;
-  }
-
-  while (true) {
-
-    if (![protocol readFieldBeginReturningName:NULL
-                                          type:&fieldType
-                                       fieldID:&fieldID
-                                         error:&error])
-    {
-      return error;
-    }
-
-    if (fieldType == TTypeSTOP) {
-      break;
-    }
-
-    switch (fieldID) {
-    case 1:
-      if (fieldType == TTypeSTRING) {
-        if (![protocol readString:&reason error:&error]) {
-          return error;
-        }
-      }
-      else {
-        if (![TProtocolUtil skipType:fieldType onProtocol:protocol error:&error]) {
-          return error;
-        }
-      }
-      break;
-
-    case 2:
-      if (fieldType == TTypeI32) {
-        if (![protocol readI32:&type error:&error]) {
-          return error;
-        }
-      }
-      else {
-        if (![TProtocolUtil skipType:fieldType onProtocol:protocol error:&error]) {
-          return error;
-        }
-      }
-      break;
-
-    default:
-      if (![TProtocolUtil skipType:fieldType onProtocol:protocol error:&error]) {
-        return error;
-      }
-      break;
-    }
-    if (![protocol readFieldEnd:&error]) {
-      return error;
-    }
-
-  }
-
-  if (![protocol readStructEnd:&error]) {
-    return error;
-  }
-
-  return [NSError errorWithType:type reason:reason];
-}
-
-
--(BOOL) write:(id<TProtocol>)protocol error:(NSError *__autoreleasing *)error
-{
-  if (![protocol writeStructBeginWithName:@"TApplicationException" error:error]) {
-    return NO;
-  }
-
-  if (self.localizedDescription != nil) {
-    if (![protocol writeFieldBeginWithName:@"message"
-                                      type:TTypeSTRING
-                                   fieldID:1 error:error])
-    {
-      return NO;
-    }
-
-    if (![protocol writeString:self.localizedDescription error:error]) {
-      return NO;
-    }
-
-    if (![protocol writeFieldEnd:error]) {
-      return NO;
-    }
-  }
-
-  if (![protocol writeFieldBeginWithName:@"type"
-                                    type:TTypeI32
-                                 fieldID:2
-                                   error:error])
-  {
-    return NO;
-  }
-
-  if (![protocol writeI32:(SInt32)self.code error:error]) {
-    return NO;
-  }
-
-  if (![protocol writeFieldEnd:error]) {
-    return NO;
-  }
-
-  if (![protocol writeFieldStop:error]) {
-    return NO;
-  }
-
-  if (![protocol writeStructEnd:error]) {
-    return NO;
-  }
-
-  return YES;
-}
-
-@end
diff --git a/lib/cocoa/src/TBaseClient.h b/lib/cocoa/src/TBaseClient.h
deleted file mode 100644
index 0f73aa0..0000000
--- a/lib/cocoa/src/TBaseClient.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-#import "TApplicationError.h"
-
-@interface TBaseClient : NSObject
-
--(NSError *) checkIncomingMessageException:(id<TProtocol>)protocol;
-
-@end
diff --git a/lib/cocoa/src/TBaseClient.m b/lib/cocoa/src/TBaseClient.m
deleted file mode 100644
index 249cae0..0000000
--- a/lib/cocoa/src/TBaseClient.m
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TBaseClient.h"
-#import "TApplicationError.h"
-
-
-@interface TBaseClient ()
-@end
-
-
-@implementation TBaseClient
-
--(NSError *) checkIncomingMessageException:(id<TProtocol>)inProtocol
-{
-  NSError *thriftError;
-
-  SInt32 msgType = 0;
-  if (![inProtocol readMessageBeginReturningName:nil type:&msgType sequenceID:NULL error:&thriftError]) {
-    return thriftError;
-  }
-
-  if (msgType == TMessageTypeEXCEPTION) {
-
-    thriftError = [NSError read:inProtocol];
-
-    [inProtocol readMessageEnd:NULL];
-
-    return thriftError;
-  }
-
-  return nil;
-}
-
-@end
diff --git a/lib/cocoa/src/TBinary.swift b/lib/cocoa/src/TBinary.swift
deleted file mode 100644
index c8a3660..0000000
--- a/lib/cocoa/src/TBinary.swift
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-public struct TBinary : TSerializable {
-  
-  public static var thriftType : TType { return .STRING }
-  
-  private var storage : NSData
-  
-  public init() {
-    self.storage = NSData()
-  }
-  
-  public init(contentsOfFile file: String, options: NSDataReadingOptions = []) throws {
-    self.storage = try NSData(contentsOfFile: file, options: options)
-  }
-  
-  public init(contentsOfURL URL: NSURL, options: NSDataReadingOptions = []) throws {
-    self.storage = try NSData(contentsOfURL: URL, options: options)
-  }
-  
-  public init?(base64EncodedData base64Data: NSData, options: NSDataBase64DecodingOptions = []) {
-    guard let storage = NSData(base64EncodedData: base64Data, options: options) else {
-      return nil
-    }
-    self.storage = storage
-  }
-  
-  public init(data: NSData) {
-    self.storage = data
-  }
-  
-  public var length : Int {
-    return storage.length
-  }
-  
-  public var hashValue : Int {
-    return storage.hashValue
-  }
-  
-  public var bytes : UnsafePointer<Void> {
-    return storage.bytes
-  }
-  
-  public func getBytes(buffer: UnsafeMutablePointer<Void>, length: Int) {
-    storage.getBytes(buffer, length: length)
-  }
-  
-  public func getBytes(buffer: UnsafeMutablePointer<Void>, range: Range<Int>) {
-    storage.getBytes(buffer, range: NSRange(range))
-  }
-  
-  public func subBinaryWithRange(range: Range<Int>) -> TBinary {
-    return TBinary(data: storage.subdataWithRange(NSRange(range)))
-  }
-  
-  public func writeToFile(path: String, options: NSDataWritingOptions = []) throws {
-    try storage.writeToFile(path, options: options)
-  }
-  
-  public func writeToURL(url: NSURL, options: NSDataWritingOptions = []) throws {
-    try storage.writeToURL(url, options: options)
-  }
-  
-  public func rangeOfData(dataToFind data: NSData, options: NSDataSearchOptions, range: Range<Int>) -> Range<Int>? {
-    return storage.rangeOfData(data, options: options, range: NSRange(range)).toRange()
-  }
-  
-  public func enumerateByteRangesUsingBlock(block: (UnsafePointer<Void>, Range<Int>, inout Bool) -> Void) {
-    storage.enumerateByteRangesUsingBlock { bytes, range, stop in
-      var stopTmp = Bool(stop.memory)
-      block(bytes, range.toRange()!, &stopTmp)
-      stop.memory = ObjCBool(stopTmp)
-    }
-  }
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> TBinary {
-    var data : NSData?
-    try proto.readBinary(&data)
-    return TBinary(data: data!)
-  }
-  
-  public static func writeValue(value: TBinary, toProtocol proto: TProtocol) throws {
-    try proto.writeBinary(value.storage)
-  }
-  
-}
-
-extension TBinary : CustomStringConvertible, CustomDebugStringConvertible {
-  
-  public var description : String {
-    return storage.description
-  }
-  
-  public var debugDescription : String {
-    return storage.debugDescription
-  }
-  
-}
-
-public func ==(lhs: TBinary, rhs: TBinary) -> Bool {
-  return lhs.storage == rhs.storage
-}
diff --git a/lib/cocoa/src/TEnum.swift b/lib/cocoa/src/TEnum.swift
deleted file mode 100644
index 562a53a..0000000
--- a/lib/cocoa/src/TEnum.swift
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-public protocol TEnum : TSerializable {
-  
-}
-
-public extension TEnum {
-  
-  public static var thriftType : TType { return TType.I32 }
-  
-}
diff --git a/lib/cocoa/src/TError.h b/lib/cocoa/src/TError.h
deleted file mode 100644
index abb72c7..0000000
--- a/lib/cocoa/src/TError.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-
-extern NSString *TErrorDomain;
diff --git a/lib/cocoa/src/TError.m b/lib/cocoa/src/TError.m
deleted file mode 100644
index df7f92d..0000000
--- a/lib/cocoa/src/TError.m
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TError.h"
-
-
-NSString *TErrorDomain = @"TErrorDomain";
diff --git a/lib/cocoa/src/TList.swift b/lib/cocoa/src/TList.swift
deleted file mode 100644
index 005bd81..0000000
--- a/lib/cocoa/src/TList.swift
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-
-public struct TList<Element : TSerializable> : MutableCollectionType, Hashable, ArrayLiteralConvertible, TSerializable {
-  
-  public static var thriftType : TType { return .LIST }
-  
-  typealias Storage = Array<Element>
-
-  public typealias Index = Storage.Index
-  
-  private var storage = Storage()
-  
-  public var startIndex : Index {
-    return storage.startIndex
-  }
-  
-  public var endIndex : Index {
-    return storage.endIndex
-  }
-
-  public subscript (position: Index) -> Element {
-    get {
-      return storage[position]
-    }
-    set {
-      storage[position] = newValue
-    }
-  }
-  
-  public var hashValue : Int {
-    let prime = 31
-    var result = 1
-    for element in storage {
-      result = prime * result + element.hashValue
-    }
-    return result
-  }
-  
-  public init(arrayLiteral elements: Element...) {
-    self.storage = Storage(storage)
-  }
-  
-  public init() {
-    self.storage = Storage()
-  }
-  
-  public mutating func append(newElement: Element) {
-    self.storage.append(newElement)
-  }
-  
-  public mutating func appendContentsOf<C : CollectionType where C.Generator.Element == Element>(newstorage: C) {
-    self.storage.appendContentsOf(newstorage)
-  }
-  
-  public mutating func insert(newElement: Element, atIndex index: Int) {
-    self.storage.insert(newElement, atIndex: index)
-  }
-  
-  public mutating func insertContentsOf<C : CollectionType where C.Generator.Element == Element>(newElements: C, at index: Int) {
-    self.storage.insertContentsOf(newElements, at: index)
-  }
-  
-  public mutating func removeAll(keepCapacity keepCapacity: Bool = true) {
-    self.storage.removeAll(keepCapacity: keepCapacity)
-  }
-  
-  public mutating func removeAtIndex(index: Index) {
-    self.storage.removeAtIndex(index)
-  }
-  
-  public mutating func removeFirst(n: Int = 0) {
-    self.storage.removeFirst(n)
-  }
-  
-  public mutating func removeLast() -> Element {
-    return self.storage.removeLast()
-  }
-  
-  public mutating func removeRange(subRange: Range<Index>) {
-    self.storage.removeRange(subRange)
-  }
-  
-  public mutating func reserveCapacity(minimumCapacity: Int) {
-    self.storage.reserveCapacity(minimumCapacity)
-  }
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> TList {
-    let (elementType, size) = try proto.readListBegin()
-    if elementType != Element.thriftType {
-      throw NSError(
-        domain: TProtocolErrorDomain,
-        code: Int(TProtocolError.InvalidData.rawValue),
-        userInfo: [TProtocolErrorExtendedErrorKey: NSNumber(int: TProtocolExtendedError.UnexpectedType.rawValue)])
-    }
-    var list = TList()
-    for _ in 0..<size {
-      let element = try Element.readValueFromProtocol(proto)
-      list.storage.append(element)
-    }
-    try proto.readListEnd()
-    return list
-  }
-  
-  public static func writeValue(value: TList, toProtocol proto: TProtocol) throws {
-    try proto.writeListBeginWithElementType(Element.thriftType, size: value.count)
-    for element in value.storage {
-      try Element.writeValue(element, toProtocol: proto)
-    }
-    try proto.writeListEnd()
-  }
-}
-
-extension TList : CustomStringConvertible, CustomDebugStringConvertible {
-  
-  public var description : String {
-    return storage.description
-  }
-  
-  public var debugDescription : String {
-    return storage.debugDescription
-  }
-  
-}
-
-public func ==<Element>(lhs: TList<Element>, rhs: TList<Element>) -> Bool {
-  return lhs.storage == rhs.storage
-}
diff --git a/lib/cocoa/src/TMap.swift b/lib/cocoa/src/TMap.swift
deleted file mode 100644
index e96e747..0000000
--- a/lib/cocoa/src/TMap.swift
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-public struct TMap<Key : TSerializable, Value : TSerializable> : CollectionType, DictionaryLiteralConvertible, TSerializable {
-  
-  public static var thriftType : TType { return .MAP }
-
-  typealias Storage = Dictionary<Key, Value>
-
-  public typealias Index = Storage.Index
-
-  public typealias Element = Storage.Element
-  
-  private var storage : Storage
-
-  public var startIndex : Index {
-    return storage.startIndex
-  }
-  
-  public var endIndex: Index {
-    return storage.endIndex
-  }
-
-  public var keys: LazyMapCollection<[Key : Value], Key> {
-    return storage.keys
-  }
-  
-  public var values: LazyMapCollection<[Key : Value], Value> {
-    return storage.values
-  }
-  
-  public init() {
-    storage = Storage()
-  }
-  
-  public init(dictionaryLiteral elements: (Key, Value)...) {
-    storage = Storage()
-    for (key, value) in elements {
-      storage[key] = value
-    }
-  }
-  
-  public init(minimumCapacity: Int) {
-    storage = Storage(minimumCapacity: minimumCapacity)
-  }
-  
-  public subscript (position: Index) -> Element {
-    get {
-      return storage[position]
-    }
-  }
-  
-  public func indexForKey(key: Key) -> Index? {
-    return storage.indexForKey(key)
-  }
-  
-  public subscript (key: Key) -> Value? {
-    get {
-      return storage[key]
-    }
-    set {
-      storage[key] = newValue
-    }
-  }
-
-  public mutating func updateValue(value: Value, forKey key: Key) -> Value? {
-    return updateValue(value, forKey: key)
-  }
-  
-  public mutating func removeAtIndex(index: DictionaryIndex<Key, Value>) -> (Key, Value) {
-    return removeAtIndex(index)
-  }
-  
-  public mutating func removeValueForKey(key: Key) -> Value? {
-    return storage.removeValueForKey(key)
-  }
-  
-  public mutating func removeAll(keepCapacity keepCapacity: Bool = false) {
-    storage.removeAll(keepCapacity: keepCapacity)
-  }
-
-  public var hashValue : Int {
-    let prime = 31
-    var result = 1
-    for (key, value) in storage {
-      result = prime * result + key.hashValue
-      result = prime * result + value.hashValue
-    }
-    return result
-  }
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> TMap {
-    let (keyType, valueType, size) = try proto.readMapBegin()
-    if keyType != Key.thriftType || valueType != Value.thriftType {
-      throw NSError(
-        domain: TProtocolErrorDomain,
-        code: Int(TProtocolError.InvalidData.rawValue),
-        userInfo: [TProtocolErrorExtendedErrorKey: NSNumber(int: TProtocolExtendedError.UnexpectedType.rawValue)])
-    }
-    var map = TMap()
-    for _ in 0..<size {
-      let key = try Key.readValueFromProtocol(proto)
-      let value = try Value.readValueFromProtocol(proto)
-      map.storage[key] = value
-    }
-    try proto.readMapEnd()
-    return map
-  }
-  
-  public static func writeValue(value: TMap, toProtocol proto: TProtocol) throws {
-    try proto.writeMapBeginWithKeyType(Key.thriftType, valueType: Value.thriftType, size: value.count)
-    for (key, value) in value.storage {
-      try Key.writeValue(key, toProtocol: proto)
-      try Value.writeValue(value, toProtocol: proto)
-    }
-    try proto.writeMapEnd()
-  }
-  
-}
-
-
-extension TMap : CustomStringConvertible, CustomDebugStringConvertible {
-  
-  public var description : String {
-    return storage.description
-  }
-  
-  public var debugDescription : String {
-    return storage.debugDescription
-  }
-  
-}
-
-public func ==<Key, Value>(lhs: TMap<Key,Value>, rhs: TMap<Key, Value>) -> Bool {
-  if lhs.count != rhs.count {
-    return false
-  }
-  return lhs.storage == rhs.storage
-}
diff --git a/lib/cocoa/src/TProcessor.h b/lib/cocoa/src/TProcessor.h
deleted file mode 100644
index 20c72e2..0000000
--- a/lib/cocoa/src/TProcessor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProtocol.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@protocol TProcessor <NSObject>
-
--(BOOL) processOnInputProtocol:(id <TProtocol>)inProtocol
-                outputProtocol:(id <TProtocol>)outProtocol
-                         error:(NSError **)error;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/TProcessorFactory.h b/lib/cocoa/src/TProcessorFactory.h
deleted file mode 100644
index 85020a5..0000000
--- a/lib/cocoa/src/TProcessorFactory.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProcessor.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@protocol TProcessorFactory <NSObject>
-
--(id<TProcessor>) processorForTransport:(id<TTransport>)transport;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/TProtocol.swift b/lib/cocoa/src/TProtocol.swift
deleted file mode 100644
index 1775849..0000000
--- a/lib/cocoa/src/TProtocol.swift
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-public extension TProtocol {
-  
-  public func readMessageBegin() throws -> (String, TMessageType, Int) {
-    
-    var name : NSString?
-    var type : Int32 = -1
-    var sequenceID : Int32 = -1
-    
-    try readMessageBeginReturningName(&name, type: &type, sequenceID: &sequenceID)
-    
-    return (name as String!, TMessageType(rawValue: type)!, Int(sequenceID))
-  }
-  
-  public func writeMessageBeginWithName(name: String, type: TMessageType, sequenceID: Int) throws {
-    try writeMessageBeginWithName(name, type: type.rawValue, sequenceID: Int32(sequenceID))
-  }
-  
-  public func readStructBegin() throws -> (String?) {
-    
-    var name : NSString? = nil
-    
-    try readStructBeginReturningName(&name)
-    
-    return (name as String?)
-  }
-  
-  public func readFieldBegin() throws -> (String?, TType, Int) {
-    
-    var name : NSString? = nil
-    var type : Int32 = -1
-    var fieldID : Int32 = -1
-    
-    try readFieldBeginReturningName(&name, type: &type, fieldID: &fieldID)
-    
-    return (name as String?, TType(rawValue: type)!, Int(fieldID))
-  }
-  
-  public func writeFieldBeginWithName(name: String, type: TType, fieldID: Int) throws {
-    try writeFieldBeginWithName(name, type: type.rawValue, fieldID: Int32(fieldID))
-  }
-  
-  public func readMapBegin() throws -> (TType, TType, Int32) {
-    
-    var keyType : Int32 = -1
-    var valueType : Int32 = -1
-    var size : Int32 = 0
-    
-    try readMapBeginReturningKeyType(&keyType, valueType: &valueType, size: &size)
-    
-    return (TType(rawValue: keyType)!, TType(rawValue: valueType)!, size)
-  }
-  
-  public func writeMapBeginWithKeyType(keyType: TType, valueType: TType, size: Int) throws {
-    try writeMapBeginWithKeyType(keyType.rawValue, valueType: valueType.rawValue, size: Int32(size))
-  }
-  
-  public func readSetBegin() throws -> (TType, Int32) {
-    
-    var elementType : Int32 = -1
-    var size : Int32 = 0
-    
-    try readSetBeginReturningElementType(&elementType, size: &size)
-    
-    return (TType(rawValue: elementType)!, size)
-  }
-  
-  public func writeSetBeginWithElementType(elementType: TType, size: Int) throws {
-    try writeSetBeginWithElementType(elementType.rawValue, size: Int32(size))
-  }
-  
-  public func readListBegin() throws -> (TType, Int32) {
-    
-    var elementType : Int32 = -1
-    var size : Int32 = 0
-    
-    try readListBeginReturningElementType(&elementType, size: &size)
-    
-    return (TType(rawValue: elementType)!, size)
-  }
-  
-  public func writeListBeginWithElementType(elementType: TType, size: Int) throws {
-    try writeListBeginWithElementType(elementType.rawValue, size: Int32(size))
-  }
-  
-  public func writeFieldValue<T: TSerializable>(value: T, name: String, type: TType, id: Int32) throws {
-    try writeFieldBeginWithName(name, type: type.rawValue, fieldID: id)
-    try writeValue(value)
-    try writeFieldEnd()
-  }
-  
-  public func readValue<T: TSerializable>() throws -> T {
-    return try T.readValueFromProtocol(self)
-  }
-  
-  public func writeValue<T: TSerializable>(value: T) throws {
-    try T.writeValue(value, toProtocol: self)
-  }
-  
-  public func readResultMessageBegin() throws {
-    
-    let (_, type, _) = try readMessageBegin();
-    
-    if type == .EXCEPTION {
-      let x = try readException()
-      throw x
-    }
-    
-    return
-  }
-  
-  public func validateValue(value: Any?, named name: String) throws {
-    
-    if value == nil {
-      throw NSError(
-        domain: TProtocolErrorDomain,
-        code: Int(TProtocolError.Unknown.rawValue),
-        userInfo: [TProtocolErrorFieldNameKey: name])
-    }
-    
-  }
-  
-  public func readException() throws -> ErrorType {
-    
-    var reason : String?
-    var type = TApplicationError.Unknown
-    
-    try readStructBegin()
-    
-    fields: while (true) {
-      
-      let (_, fieldType, fieldID) = try readFieldBegin()
-      
-      switch (fieldID, fieldType) {
-      case (_, .STOP):
-        break fields
-        
-      case (1, .STRING):
-        reason = try readValue() as String
-        
-      case (2, .I32):
-        let typeVal = try readValue() as Int32
-        if let tmp = TApplicationError(rawValue: typeVal) {
-          type = tmp
-        }
-        
-      case let (_, unknownType):
-        try skipType(unknownType)
-      }
-      
-      try readFieldEnd()
-    }
-    
-    try readStructEnd()
-    
-    return NSError(type:type, reason:reason ?? "")
-  }
-  
-  public func writeExceptionForMessageName(name: String, sequenceID: Int, ex: NSError) throws {
-    try writeMessageBeginWithName(name, type: .EXCEPTION, sequenceID: sequenceID)
-    try ex.write(self)
-    try writeMessageEnd()
-  }
-  
-  public func skipType(type: TType) throws {
-    try TProtocolUtil.skipType(type.rawValue, onProtocol: self)
-  }
-  
-}
diff --git a/lib/cocoa/src/TSerializable.swift b/lib/cocoa/src/TSerializable.swift
deleted file mode 100644
index 3fdfd41..0000000
--- a/lib/cocoa/src/TSerializable.swift
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-public protocol TSerializable : Hashable {
-  
-  static var thriftType : TType { get }
-  
-  init()
-  
-  static func readValueFromProtocol(proto: TProtocol) throws -> Self
-  
-  static func writeValue(value: Self, toProtocol proto: TProtocol) throws
-  
-}
-
-
-
-infix operator ?== {}
-
-public func ?==<T: TSerializable>(lhs: T?, rhs: T?) -> Bool {
-  if let l = lhs, r = rhs {
-    return l == r
-  }
-  return lhs == rhs
-}
-
-public func ?==<T: TSerializable>(lhs: T, rhs: T) -> Bool {
-  return lhs == rhs
-}
-
-
-
-extension Bool : TSerializable {
-  
-  public static let thriftType = TType.BOOL
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> Bool {
-    var value : ObjCBool = false
-    try proto.readBool(&value)
-    return value.boolValue
-  }
-  
-  public static func writeValue(value: Bool, toProtocol proto: TProtocol) throws {
-    try proto.writeBool(value)
-  }
-  
-}
-
-extension Int8 : TSerializable {
-  
-  public static let thriftType = TType.BYTE
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> Int8 {
-    var value = UInt8()
-    try proto.readByte(&value)
-    return Int8(value)
-  }
-  
-  public static func writeValue(value: Int8, toProtocol proto: TProtocol) throws {
-    try proto.writeByte(UInt8(value))
-  }
-  
-}
-
-extension Int16 : TSerializable {
-  
-  public static let thriftType = TType.I16
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> Int16 {
-    var value = Int16()
-    try proto.readI16(&value)
-    return value
-  }
-  
-  public static func writeValue(value: Int16, toProtocol proto: TProtocol) throws {
-    try proto.writeI16(value)
-  }
-  
-}
-
-extension Int : TSerializable {
-  
-  public static let thriftType = TType.I32
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> Int {
-    var value = Int32()
-    try proto.readI32(&value)
-    return Int(value)
-  }
-  
-  public static func writeValue(value: Int, toProtocol proto: TProtocol) throws {
-    try proto.writeI32(Int32(value))
-  }
-  
-}
-
-extension Int32 : TSerializable {
-  
-  public static let thriftType = TType.I32
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> Int32 {
-    var value = Int32()
-    try proto.readI32(&value)
-    return value
-  }
-  
-  public static func writeValue(value: Int32, toProtocol proto: TProtocol) throws {
-    try proto.writeI32(value)
-  }
-  
-}
-
-extension Int64 : TSerializable {
-  
-  public static let thriftType = TType.I64
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> Int64 {
-    var value = Int64()
-    try proto.readI64(&value)
-    return value
-  }
-  
-  public static func writeValue(value: Int64, toProtocol proto: TProtocol) throws {
-    try proto.writeI64(value)
-  }
-  
-}
-
-extension Double : TSerializable {
-  
-  public static let thriftType = TType.DOUBLE
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> Double {
-    var value = Double()
-    try proto.readDouble(&value)
-    return value
-  }
-  
-  public static func writeValue(value: Double, toProtocol proto: TProtocol) throws {
-    try proto.writeDouble(value)
-  }
-  
-}
-
-extension String : TSerializable {
-  
-  public static let thriftType = TType.STRING
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> String {
-    var value : NSString?
-    try proto.readString(&value)
-    return value as! String
-  }
-  
-  public static func writeValue(value: String, toProtocol proto: TProtocol) throws {
-    try proto.writeString(value)
-  }
-  
-}
diff --git a/lib/cocoa/src/TSet.swift b/lib/cocoa/src/TSet.swift
deleted file mode 100644
index 85833e5..0000000
--- a/lib/cocoa/src/TSet.swift
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-public struct TSet<Element : TSerializable> : CollectionType, ArrayLiteralConvertible, TSerializable {
-  
-  public static var thriftType : TType { return .SET }
-  
-  public typealias Index = Storage.Index
-  
-  typealias Storage = Set<Element>
-  
-  private var storage : Storage
-  
-  public init() {
-    storage = Storage()
-  }
-  
-  public init(arrayLiteral elements: Element...) {
-    storage = Storage(elements)
-  }
-  
-  public init<S : SequenceType where S.Generator.Element == Element>(_ sequence: S) {
-    storage = Storage(sequence)    
-  }
-  
-  public var startIndex : Index { return storage.startIndex }
-  
-  public var endIndex : Index { return storage.endIndex }
-  
-  public mutating func insert(member: Element) {
-    return storage.insert(member)
-  }
-  
-  public mutating func remove(element: Element) -> Element? {
-    return storage.remove(element)
-  }
-  
-  public mutating func removeAll(keepCapacity keepCapacity: Bool = false) {
-    return storage.removeAll(keepCapacity: keepCapacity)
-  }
-  
-  public mutating func removeAtIndex(index: SetIndex<Element>) -> Element {
-    return storage.removeAtIndex(index)
-  }
-  
-  public subscript (position: SetIndex<Element>) -> Element {
-    return storage[position]
-  }
-  
-  public func union(other: TSet) -> TSet {
-    return TSet(storage.union(other))
-  }
-  
-  public func intersect(other: TSet) -> TSet {
-    return TSet(storage.intersect(other))
-  }
-  
-  public func exclusiveOr(other: TSet) -> TSet {
-    return TSet(storage.exclusiveOr(other))
-  }
-  
-  public func subtract(other: TSet) -> TSet {
-    return TSet(storage.subtract(other))
-  }
-  
-  public mutating func intersectInPlace(other: TSet) {
-    storage.intersectInPlace(other)
-  }
-
-  public mutating func exclusiveOrInPlace(other: TSet) {
-    storage.exclusiveOrInPlace(other)
-  }
-
-  public mutating func subtractInPlace(other: TSet) {
-    storage.subtractInPlace(other)
-  }  
-
-  public func isSubsetOf(other: TSet) -> Bool {
-    return storage.isSubsetOf(other)
-  }
-
-  public func isDisjointWith(other: TSet) -> Bool {
-    return storage.isDisjointWith(other)
-  }
-  
-  public func isSupersetOf(other: TSet) -> Bool {
-    return storage.isSupersetOf(other)
-  }
-
-  public var isEmpty: Bool { return storage.isEmpty }
-
-  public var hashValue : Int {
-    let prime = 31
-    var result = 1
-    for element in storage {
-      result = prime * result + element.hashValue
-    }
-    return result
-  }
-  
-  public static func readValueFromProtocol(proto: TProtocol) throws -> TSet {
-    let (elementType, size) = try proto.readSetBegin()
-    if elementType != Element.thriftType {
-      throw NSError(
-        domain: TProtocolErrorDomain,
-        code: Int(TProtocolError.InvalidData.rawValue),
-        userInfo: [TProtocolErrorExtendedErrorKey: NSNumber(int: elementType.rawValue)])
-    }
-    var set = TSet()
-    for _ in 0..<size {
-      let element = try Element.readValueFromProtocol(proto)
-      set.storage.insert(element)
-    }
-    try proto.readSetEnd()
-    return set
-  }
-  
-  public static func writeValue(value: TSet, toProtocol proto: TProtocol) throws {
-    try proto.writeSetBeginWithElementType(Element.thriftType, size: value.count)
-    for element in value.storage {
-      try Element.writeValue(element, toProtocol: proto)
-    }
-    try proto.writeSetEnd()
-  }
-  
-}
-
-extension TSet : CustomStringConvertible, CustomDebugStringConvertible {
-  
-  public var description : String {
-    return storage.description
-  }
-  
-  public var debugDescription : String {
-    return storage.debugDescription
-  }
-  
-}
-
-public func ==<Element>(lhs: TSet<Element>, rhs: TSet<Element>) -> Bool {
-  return lhs.storage == rhs.storage
-}
diff --git a/lib/cocoa/src/TSharedProcessorFactory.h b/lib/cocoa/src/TSharedProcessorFactory.h
deleted file mode 100644
index c75fad1..0000000
--- a/lib/cocoa/src/TSharedProcessorFactory.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProcessorFactory.h"
-
-
-@interface TSharedProcessorFactory : NSObject <TProcessorFactory>
-
--(id) initWithSharedProcessor:(id<TProcessor>)sharedProcessor;
-
-@end
diff --git a/lib/cocoa/src/TSharedProcessorFactory.m b/lib/cocoa/src/TSharedProcessorFactory.m
deleted file mode 100644
index 3d55f47..0000000
--- a/lib/cocoa/src/TSharedProcessorFactory.m
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-#import "TSharedProcessorFactory.h"
-
-
-@interface TSharedProcessorFactory ()
-
-@property(strong, nonatomic) id<TProcessor> sharedProcessor;
-
-@end
-
-
-@implementation TSharedProcessorFactory
-
-
--(id) initWithSharedProcessor:(id<TProcessor>)sharedProcessor
-{
-  self = [super init];
-  if (self) {
-    _sharedProcessor = sharedProcessor;
-  }
-
-  return self;
-}
-
--(id<TProcessor>) processorForTransport:(id<TTransport>)transport
-{
-  return _sharedProcessor;
-}
-
-@end
diff --git a/lib/cocoa/src/TStruct.swift b/lib/cocoa/src/TStruct.swift
deleted file mode 100644
index cea72e7..0000000
--- a/lib/cocoa/src/TStruct.swift
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import Foundation
-
-
-public protocol TStruct : TSerializable {
-}
-
-
-public extension TStruct {
-  
-  public static var thriftType : TType { return TType.STRUCT }
-  
-}
diff --git a/lib/cocoa/src/Thrift.h b/lib/cocoa/src/Thrift.h
deleted file mode 100644
index d01826d..0000000
--- a/lib/cocoa/src/Thrift.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#define ThriftVersion @"1.0.0"
diff --git a/lib/cocoa/src/protocol/TBase.h b/lib/cocoa/src/protocol/TBase.h
deleted file mode 100644
index 9935d50..0000000
--- a/lib/cocoa/src/protocol/TBase.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "TProtocol.h"
-
-@protocol TBase <NSObject>
-
-/**
- * De-serialize object from the given input protocol
- *
- * @param inProtocol protocol used for reading
- */
--(BOOL) read:(id <TProtocol>)inProtocol error:(NSError **)error;
-
-/**
- * Serialize object to the given protocol
- *
- * @param outProtocol output protocol used for writing
- */
--(BOOL) write:(id <TProtocol>)outProtocol error:(NSError **)error;
-
-
-/**
- * Validate required fields
- */
--(BOOL) validate:(NSError *__autoreleasing *)__thriftError;
-
-@end
diff --git a/lib/cocoa/src/protocol/TBinaryProtocol.h b/lib/cocoa/src/protocol/TBinaryProtocol.h
deleted file mode 100644
index bb90fad..0000000
--- a/lib/cocoa/src/protocol/TBinaryProtocol.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-#import "TTransport.h"
-#import "TProtocolFactory.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TBinaryProtocol : NSObject <TProtocol>
-
-@property (assign, nonatomic) UInt32 messageSizeLimit;
-
--(id) initWithTransport:(id <TTransport>)transport;
-
--(id) initWithTransport:(id <TTransport>)transport
-             strictRead:(BOOL)strictRead
-            strictWrite:(BOOL)strictWrite;
-
-@end;
-
-
-@interface TBinaryProtocolFactory : NSObject <TProtocolFactory>
-
-+(TBinaryProtocolFactory *) sharedFactory;
-
--(TBinaryProtocol *) newProtocolOnTransport:(id <TTransport>)transport;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
\ No newline at end of file
diff --git a/lib/cocoa/src/protocol/TBinaryProtocol.m b/lib/cocoa/src/protocol/TBinaryProtocol.m
deleted file mode 100644
index 1f9e57a..0000000
--- a/lib/cocoa/src/protocol/TBinaryProtocol.m
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TBinaryProtocol.h"
-#import "TProtocolError.h"
-
-
-static SInt32 VERSION_1 = 0x80010000;
-static SInt32 VERSION_MASK = 0xffff0000;
-
-
-static TBinaryProtocolFactory *gSharedFactory = nil;
-
-
-@implementation TBinaryProtocolFactory
-
-+(TBinaryProtocolFactory *) sharedFactory
-{
-  if (gSharedFactory == nil) {
-    gSharedFactory = [[TBinaryProtocolFactory alloc] init];
-  }
-
-  return gSharedFactory;
-}
-
--(NSString *) protocolName
-{
-  return @"binary";
-}
-
--(TBinaryProtocol *) newProtocolOnTransport:(id <TTransport>)transport
-{
-  return [[TBinaryProtocol alloc] initWithTransport:transport];
-}
-
-@end
-
-
-@interface TBinaryProtocol ()
-
-@property(strong, nonatomic) id <TTransport> transport;
-
-@property(assign, nonatomic) BOOL strictRead;
-@property(assign, nonatomic) BOOL strictWrite;
-
-@property(strong, nonatomic) NSString *currentMessageName;
-@property(strong, nonatomic) NSString *currentFieldName;
-
-@end
-
-
-@implementation TBinaryProtocol
-
--(id) initWithTransport:(id <TTransport>)aTransport
-{
-  return [self initWithTransport:aTransport strictRead:NO strictWrite:YES];
-}
-
--(id) initWithTransport:(id <TTransport>)transport
-             strictRead:(BOOL)strictRead
-            strictWrite:(BOOL)strictWrite
-{
-  self = [super init];
-  if (self) {
-    _transport = transport;
-    _strictRead = strictRead;
-    _strictWrite = strictWrite;
-  }
-  return self;
-}
-
--(id <TTransport>) transport
-{
-  return _transport;
-}
-
--(NSString *) readStringBody:(int)size error:(NSError **)error
-{
-  NSMutableData *data = [NSMutableData dataWithLength:size];
-  if (!data) {
-    PROTOCOL_ERROR(nil, Unknown, @"Unable to allocate %d bytes", size);
-  }
-
-  if (![_transport readAll:data.mutableBytes offset:0 length:size error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(nil, error, @"Transport read failed");
-  }
-
-  return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-}
-
-
--(BOOL) readMessageBeginReturningName:(NSString **)name
-                                 type:(SInt32 *)type
-                           sequenceID:(SInt32 *)sequenceID
-                                error:(NSError *__autoreleasing *)error
-{
-  SInt32 size;
-  if (![self readI32:&size error:error]) {
-    return NO;
-  }
-  ;
-
-  if (size < 0) {
-    int version = size & VERSION_MASK;
-    if (version != VERSION_1) {
-      PROTOCOL_ERROR(NO, BadVersion, @"Bad message version");
-    }
-    if (type != NULL) {
-      *type = size & 0x00FF;
-    }
-    NSString *messageName;
-    if (![self readString:&messageName error:error]) {
-      return NO;
-    }
-    if (name != nil) {
-      *name = messageName;
-    }
-  }
-  else {
-
-    if (_strictRead) {
-      PROTOCOL_ERROR(NO, InvalidData, @"Missing message version, old client?");
-    }
-
-    if (_messageSizeLimit > 0 && size > _messageSizeLimit) {
-      PROTOCOL_ERROR(NO, SizeLimit, @"Message exceeeds size limit of %d", (int)size);
-    }
-
-    NSString *messageName = [self readStringBody:size error:error];
-    if (!messageName) {
-      return NO;
-    }
-
-    if (name != NULL) {
-      *name = messageName;
-    }
-
-    UInt8 messageType;
-    if (![self readByte:&messageType error:error]) {
-      return NO;
-    }
-
-    if (type != NULL) {
-      *type = messageType;
-    }
-  }
-
-  SInt32 seqID;
-  if (![self readI32:&seqID error:error]) {
-    return NO;
-  }
-  if (sequenceID != NULL) {
-    *sequenceID = seqID;
-  }
-
-  return YES;
-}
-
-
--(BOOL) readMessageEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) readStructBeginReturningName:(NSString *__autoreleasing *)name error:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) readStructEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) readFieldBeginReturningName:(NSString *__autoreleasing *)name
-                               type:(SInt32 *)fieldType
-                            fieldID:(SInt32 *)fieldID
-                              error:(NSError *__autoreleasing *)error
-{
-  if (name != nil) {
-    *name = nil;
-  }
-
-  UInt8 ft;
-  if (![self readByte:&ft error:error]) {
-    return NO;
-  }
-  if (fieldType != NULL) {
-    *fieldType = ft;
-  }
-  if (ft != TTypeSTOP) {
-    SInt16 fid;
-    if (![self readI16:&fid error:error]) {
-      return NO;
-    }
-    if (fieldID != NULL) {
-      *fieldID = fid;
-    }
-  }
-  return YES;
-}
-
-
--(BOOL) readFieldEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) readString:(NSString *__autoreleasing *)value error:(NSError *__autoreleasing *)error
-{
-  SInt32 size;
-  if (![self readI32:&size error:error]) {
-    return NO;
-  }
-
-  NSString *string = [self readStringBody:size error:error];
-  if (!string) {
-    return NO;
-  }
-
-  *value = string;
-
-  return YES;
-}
-
-
--(BOOL) readBool:(BOOL *)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 byte;
-  if (![self readByte:&byte error:error]) {
-    return NO;
-  }
-
-  *value = byte == 1;
-
-  return YES;
-}
-
-
--(BOOL) readByte:(UInt8 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 buff[1];
-  if (![_transport readAll:buff offset:0 length:1 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-  }
-
-  *value = buff[0];
-
-  return YES;
-}
-
-
--(BOOL) readI16:(SInt16 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 buff[2];
-  if (![_transport readAll:buff offset:0 length:2 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-  }
-
-  *value =
-    ((SInt16)(buff[0] & 0xff) << 8) |
-    ((SInt16)(buff[1] & 0xff));
-
-  return YES;
-}
-
-
--(BOOL) readI32:(SInt32 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 i32rd[4];
-  if (![_transport readAll:i32rd offset:0 length:4 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-  }
-
-  *value =
-    ((i32rd[0] & 0xff) << 24) |
-    ((i32rd[1] & 0xff) << 16) |
-    ((i32rd[2] & 0xff) <<  8) |
-    ((i32rd[3] & 0xff));
-
-  return YES;
-}
-
-
--(BOOL) readI64:(SInt64 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 buff[8];
-  if (![_transport readAll:buff offset:0 length:8 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-  }
-
-  *value =
-    ((SInt64)(buff[0] & 0xff) << 56) |
-    ((SInt64)(buff[1] & 0xff) << 48) |
-    ((SInt64)(buff[2] & 0xff) << 40) |
-    ((SInt64)(buff[3] & 0xff) << 32) |
-    ((SInt64)(buff[4] & 0xff) << 24) |
-    ((SInt64)(buff[5] & 0xff) << 16) |
-    ((SInt64)(buff[6] & 0xff) <<  8) |
-    ((SInt64)(buff[7] & 0xff));
-
-  return YES;
-}
-
-
--(BOOL) readDouble:(double *)value error:(NSError *__autoreleasing *)error
-{
-  // FIXME - will this get us into trouble on PowerPC?
-  return [self readI64:(SInt64 *)value error:error];
-}
-
-
--(BOOL) readBinary:(NSData *__autoreleasing *)value error:(NSError *__autoreleasing *)error
-{
-  SInt32 size;
-  if (![self readI32:&size error:error]) {
-    return NO;
-  }
-
-  NSMutableData *data = [NSMutableData dataWithLength:size];
-  if (!data) {
-    PROTOCOL_ERROR(NO, Unknown, @"Unable to allocate %d bytes", (int)size);
-  }
-
-  if (![_transport readAll:data.mutableBytes offset:0 length:size error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-  }
-
-  *value = data;
-
-  return YES;
-}
-
-
--(BOOL) readMapBeginReturningKeyType:(SInt32 *)keyType
-                           valueType:(SInt32 *)valueType
-                                size:(SInt32 *)size
-                               error:(NSError *__autoreleasing *)error
-{
-  UInt8 kt;
-  if (![self readByte:&kt error:error]) {
-    return NO;
-  }
-
-  UInt8 vt;
-  if (![self readByte:&vt error:error]) {
-    return NO;
-  }
-
-  SInt32 s;
-  if (![self readI32:&s error:error]) {
-    return NO;
-  }
-
-  if (keyType != NULL) {
-    *keyType = kt;
-  }
-
-  if (valueType != NULL) {
-    *valueType = vt;
-  }
-
-  if (size != NULL) {
-    *size = s;
-  }
-
-  return YES;
-}
-
-
--(BOOL) readMapEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) readSetBeginReturningElementType:(SInt32 *)elementType
-                                    size:(SInt32 *)size
-                                   error:(NSError *__autoreleasing *)error
-{
-  UInt8 et;
-  if (![self readByte:&et error:error]) {
-    return NO;
-  }
-
-  SInt32 s;
-  if (![self readI32:&s error:error]) {
-    return NO;
-  }
-
-  if (elementType != NULL) {
-    *elementType = et;
-  }
-
-  if (size != NULL) {
-    *size = s;
-  }
-
-  return YES;
-}
-
-
--(BOOL) readSetEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) readListBeginReturningElementType:(SInt32 *)elementType
-                                     size:(SInt32 *)size
-                                    error:(NSError *__autoreleasing *)error
-{
-  UInt8 et;
-  if (![self readByte:&et error:error]) {
-    return NO;
-  }
-
-  SInt32 s;
-  if (![self readI32:&s error:error]) {
-    return NO;
-  }
-
-  if (elementType != NULL) {
-    *elementType = et;
-  }
-
-  if (size != NULL) {
-    *size = s;
-  }
-
-  return YES;
-}
-
-
--(BOOL) readListEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
-
--(BOOL) writeMessageBeginWithName:(NSString *)name
-                             type:(SInt32)messageType
-                       sequenceID:(SInt32)sequenceID
-                            error:(NSError *__autoreleasing *)error
-{
-  if (_strictWrite) {
-
-    int version = VERSION_1 | messageType;
-
-    if (![self writeI32:version error:error]) {
-      return NO;
-    }
-
-    if (![self writeString:name error:error]) {
-      return NO;
-    }
-
-    if (![self writeI32:sequenceID error:error]) {
-      return NO;
-    }
-  }
-  else {
-
-    if (![self writeString:name error:error]) {
-      return NO;
-    }
-
-    if (![self writeByte:messageType error:error]) {
-      return NO;
-    }
-
-    if (![self writeI32:sequenceID error:error]) {
-      return NO;
-    }
-  }
-
-  _currentMessageName = name;
-
-  return YES;
-}
-
-
--(BOOL) writeMessageEnd:(NSError *__autoreleasing *)error
-{
-  _currentMessageName = nil;
-  return YES;
-}
-
-
--(BOOL) writeStructBeginWithName:(NSString *)name
-                           error:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) writeStructEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) writeFieldBeginWithName:(NSString *)name
-                           type:(SInt32)fieldType
-                        fieldID:(SInt32)fieldID
-                          error:(NSError *__autoreleasing *)error
-{
-  if (![self writeByte:fieldType error:error]) {
-    return NO;
-  }
-
-  if (![self writeI16:fieldID error:error]) {
-    return NO;
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeBool:(BOOL)value error:(NSError *__autoreleasing *)error
-{
-  return [self writeByte:(value ? 1 : 0) error:error];
-}
-
-
--(BOOL) writeByte:(UInt8)value error:(NSError *__autoreleasing *)error
-{
-  if (![_transport write:&value offset:0 length:1 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-  return YES;
-}
-
-
--(BOOL) writeI16:(short)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 buff[2];
-  buff[0] = 0xff & (value >> 8);
-  buff[1] = 0xff & value;
-
-  if (![_transport write:buff offset:0 length:2 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeI32:(SInt32)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 buff[4];
-  buff[0] = 0xFF & (value >> 24);
-  buff[1] = 0xFF & (value >> 16);
-  buff[2] = 0xFF & (value >> 8);
-  buff[3] = 0xFF & value;
-
-  if (![_transport write:buff offset:0 length:4 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeI64:(SInt64)value error:(NSError *__autoreleasing *)error
-{
-  UInt8 buff[8];
-  buff[0] = 0xFF & (value >> 56);
-  buff[1] = 0xFF & (value >> 48);
-  buff[2] = 0xFF & (value >> 40);
-  buff[3] = 0xFF & (value >> 32);
-  buff[4] = 0xFF & (value >> 24);
-  buff[5] = 0xFF & (value >> 16);
-  buff[6] = 0xFF & (value >> 8);
-  buff[7] = 0xFF & value;
-
-  if (![_transport write:buff offset:0 length:8 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeDouble:(double)value error:(NSError *__autoreleasing *)error
-{
-  // FIXME - will this get us in trouble on PowerPC?
-  if (![self writeI64:*(SInt64 *)&value error:error]) {
-    return NO;
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeString:(NSString *)value error:(NSError *__autoreleasing *)error
-{
-  if (value != nil) {
-
-    const char *utf8Bytes = [value UTF8String];
-
-    SInt32 length = (SInt32)strlen(utf8Bytes);
-    if (![self writeI32:length error:error]) {
-      return NO;
-    }
-
-    if (![_transport write:(UInt8 *)utf8Bytes offset:0 length:(int)length error:error]) {
-      PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-    }
-
-  }
-  else {
-
-    // instead of crashing when we get null, let's write out a zero
-    // length string
-    if (![self writeI32:0 error:error]) {
-      return NO;
-    }
-
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeBinary:(NSData *)data error:(NSError *__autoreleasing *)error
-{
-  if (![self writeI32:(SInt32)data.length error:error]) {
-    return NO;
-  }
-
-  if (![_transport write:data.bytes offset:0 length:(UInt32)data.length error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeFieldStop:(NSError *__autoreleasing *)error
-{
-  if (![self writeByte:TTypeSTOP error:error]) {
-    return NO;
-  }
-
-  return YES;
-}
-
-
--(BOOL) writeFieldEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) writeMapBeginWithKeyType:(SInt32)keyType
-                       valueType:(SInt32)valueType
-                            size:(SInt32)size
-                           error:(NSError *__autoreleasing *)error
-{
-  if (![self writeByte:keyType error:error]) {
-    return NO;
-  }
-  if (![self writeByte:valueType error:error]) {
-    return NO;
-  }
-  if (![self writeI32:(int)size error:error]) {
-    return NO;
-  }
-  return YES;
-}
-
-
--(BOOL) writeMapEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) writeSetBeginWithElementType:(SInt32)elementType
-                                size:(SInt32)size
-                               error:(NSError *__autoreleasing *)error
-{
-  if (![self writeByte:elementType error:error]) {
-    return NO;
-  }
-  if (![self writeI32:size error:error]) {
-    return NO;
-  }
-  return YES;
-}
-
-
--(BOOL) writeSetEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-
--(BOOL) writeListBeginWithElementType:(SInt32)elementType
-                                 size:(SInt32)size
-                                error:(NSError *__autoreleasing *)error
-{
-  if (![self writeByte:elementType error:error]) {
-    return NO;
-  }
-  if (![self writeI32:size error:error]) {
-    return NO;
-  }
-  return YES;
-}
-
-
--(BOOL) writeListEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-@end
diff --git a/lib/cocoa/src/protocol/TCompactProtocol.h b/lib/cocoa/src/protocol/TCompactProtocol.h
deleted file mode 100644
index 3f6accc..0000000
--- a/lib/cocoa/src/protocol/TCompactProtocol.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-#import "TTransport.h"
-#import "TProtocolFactory.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TCompactProtocol : NSObject <TProtocol>
-
--(id) initWithTransport:(id <TTransport>)transport;
-
-@end
-
-@interface TCompactProtocolFactory : NSObject <TProtocolFactory>
-
-+(TCompactProtocolFactory *) sharedFactory;
-
--(TCompactProtocol *) newProtocolOnTransport:(id <TTransport>)transport;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
\ No newline at end of file
diff --git a/lib/cocoa/src/protocol/TCompactProtocol.m b/lib/cocoa/src/protocol/TCompactProtocol.m
deleted file mode 100644
index 9b0ebb2..0000000
--- a/lib/cocoa/src/protocol/TCompactProtocol.m
+++ /dev/null
@@ -1,983 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TCompactProtocol.h"
-#import "TProtocolError.h"
-
-static const UInt8 COMPACT_PROTOCOL_ID = 0x82;
-static const UInt8 COMPACT_VERSION = 1;
-static const UInt8 COMPACT_VERSION_MASK = 0x1F; // 0001 1111
-static const UInt8 COMPACT_TYPE_MASK = 0xE0; // 1110 0000
-static const UInt8 COMPACT_TYPE_BITS = 0x07; // 0000 0111
-static const int COMPACT_TYPE_SHIFT_AMOUNT = 5;
-
-enum {
-  TCType_STOP = 0x00,
-  TCType_BOOLEAN_TRUE = 0x01,
-  TCType_BOOLEAN_FALSE = 0x02,
-  TCType_BYTE = 0x03,
-  TCType_I16 = 0x04,
-  TCType_I32 = 0x05,
-  TCType_I64 = 0x06,
-  TCType_DOUBLE = 0x07,
-  TCType_BINARY = 0x08,
-  TCType_LIST = 0x09,
-  TCType_SET = 0x0A,
-  TCType_MAP = 0x0B,
-  TCType_STRUCT = 0x0C,
-};
-
-@implementation TCompactProtocolFactory
-
-+(TCompactProtocolFactory *) sharedFactory
-{
-  static TCompactProtocolFactory *gSharedFactory = nil;
-  if (gSharedFactory == nil) {
-    gSharedFactory = [[TCompactProtocolFactory alloc] init];
-  }
-
-  return gSharedFactory;
-}
-
--(NSString *) protocolName
-{
-  return @"compact";
-}
-
--(TCompactProtocol *) newProtocolOnTransport:(id <TTransport>)transport
-{
-  return [[TCompactProtocol alloc] initWithTransport:transport];
-}
-
-@end
-
-
-@interface TCompactProtocol ()
-
-@property(strong, nonatomic) id <TTransport> transport;
-
-@property(strong, nonatomic) NSMutableArray *lastField;
-@property(assign, nonatomic) short lastFieldId;
-
-@property(strong, nonatomic) NSString *boolFieldName;
-@property(strong, nonatomic) NSNumber *boolFieldType;
-@property(strong, nonatomic) NSNumber *boolFieldId;
-@property(strong, nonatomic) NSNumber *booleanValue;
-
-@property(strong, nonatomic) NSString *currentMessageName;
-
-@end
-
-
-@implementation TCompactProtocol
-
--(id) init
-{
-  self = [super init];
-
-  if (self != nil) {
-    _lastField = [[NSMutableArray alloc] init];
-  }
-
-  return self;
-}
-
--(id) initWithTransport:(id <TTransport>)aTransport
-{
-  self = [self init];
-
-  if (self != nil) {
-    _transport = aTransport;
-  }
-
-  return self;
-}
-
--(id <TTransport>) transport
-{
-  return _transport;
-}
-
--(BOOL) writeByteDirect:(UInt8)n error:(NSError *__autoreleasing *)error
-{
-  if (![_transport write:(UInt8 *)&n offset:0 length:1 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-  return YES;
-}
-
--(BOOL) writeVarint32:(UInt32)n error:(NSError *__autoreleasing *)error
-{
-  UInt8 i32buf[5] = {0};
-  UInt32 idx = 0;
-
-  while (true) {
-    if ((n & ~0x7F) == 0) {
-      i32buf[idx++] = (UInt8)n;
-      break;
-    }
-    else {
-      i32buf[idx++] = (UInt8)((n & 0x7F) | 0x80);
-      n >>= 7;
-    }
-  }
-
-  if (![_transport write:i32buf offset:0 length:idx error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-
-  return YES;
-}
-
--(BOOL) writeMessageBeginWithName:(NSString *)name
-                             type:(SInt32)messageType
-                       sequenceID:(SInt32)sequenceID
-                            error:(NSError *__autoreleasing *)error
-{
-  if (![self writeByteDirect:COMPACT_PROTOCOL_ID error:error]) {
-    return NO;
-  }
-  if (![self writeByteDirect:(UInt8)((COMPACT_VERSION & COMPACT_VERSION_MASK) |
-                                     ((((UInt32)messageType) << COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_MASK)) error:error])
-  {
-    return NO;
-  }
-  if (![self writeVarint32:(UInt32)sequenceID error:error]) {
-    return NO;
-  }
-  if (![self writeString:name error:error]) {
-    return NO;
-  }
-
-  _currentMessageName = name;
-
-  return YES;
-}
-
--(BOOL) writeStructBeginWithName:(NSString *)name error:(NSError *__autoreleasing *)error
-{
-  [_lastField addObject:@(_lastFieldId)];
-  _lastFieldId = 0;
-  return YES;
-}
-
--(BOOL) writeStructEnd:(NSError *__autoreleasing *)error
-{
-  _lastFieldId = [_lastField.lastObject shortValue];
-  [_lastField removeLastObject];
-  return YES;
-}
-
--(BOOL) writeFieldBeginWithName:(NSString *)name
-                           type:(SInt32)fieldType
-                        fieldID:(SInt32)fieldID
-                          error:(NSError *__autoreleasing *)error
-{
-  if (fieldType == TTypeBOOL) {
-    _boolFieldName = [name copy];
-    _boolFieldType = @(fieldType);
-    _boolFieldId = @(fieldID);
-    return YES;
-  }
-  else {
-    return [self writeFieldBeginInternalWithName:name
-                                            type:fieldType
-                                         fieldID:fieldID
-                                    typeOverride:0xFF
-                                           error:error];
-  }
-}
-
--(BOOL) writeFieldBeginInternalWithName:(NSString *)name
-                                   type:(SInt32)fieldType
-                                fieldID:(SInt32)fieldID
-                           typeOverride:(UInt8)typeOverride
-                                  error:(NSError *__autoreleasing *)error
-{
-  UInt8 typeToWrite = typeOverride == 0xFF ? [self compactTypeForTType:fieldType] : typeOverride;
-
-  // check if we can use delta encoding for the field id
-  if (fieldID > _lastFieldId && fieldID - _lastFieldId <= 15) {
-    // Write them together
-    if (![self writeByteDirect:(fieldID - _lastFieldId) << 4 | typeToWrite error:error]) {
-      return NO;
-    }
-  }
-  else {
-    // Write them separate
-    if (![self writeByteDirect:typeToWrite error:error]) {
-      return NO;
-    }
-    if (![self writeI16:fieldID error:error]) {
-      return NO;
-    }
-  }
-
-  _lastFieldId = fieldID;
-
-  return YES;
-}
-
--(BOOL) writeFieldStop:(NSError *__autoreleasing *)error
-{
-  return [self writeByteDirect:TCType_STOP error:error];
-}
-
--(BOOL) writeMapBeginWithKeyType:(SInt32)keyType
-                       valueType:(SInt32)valueType
-                            size:(SInt32)size
-                           error:(NSError *__autoreleasing *)error
-{
-  if (size == 0) {
-    if (![self writeByteDirect:0 error:error]) {
-      return NO;
-    }
-  }
-  else {
-    if (![self writeVarint32:(UInt32)size error:error]) {
-      return NO;
-    }
-    if (![self writeByteDirect:[self compactTypeForTType:keyType] << 4 | [self compactTypeForTType:valueType] error:error]) {
-      return NO;
-    }
-  }
-  return YES;
-}
-
--(BOOL) writeListBeginWithElementType:(SInt32)elementType
-                                 size:(SInt32)size
-                                error:(NSError *__autoreleasing *)error
-{
-  return [self writeCollectionBeginWithElementType:elementType size:size error:error];
-}
-
--(BOOL) writeSetBeginWithElementType:(SInt32)elementType
-                                size:(SInt32)size
-                               error:(NSError *__autoreleasing *)error
-{
-  return [self writeCollectionBeginWithElementType:elementType size:size error:error];
-}
-
--(BOOL) writeBool:(BOOL)b error:(NSError *__autoreleasing *)error
-{
-  BOOL result;
-  if (_boolFieldId != nil && _boolFieldName != nil && _boolFieldType != nil) {
-    // we haven't written the field header yet
-    result = [self writeFieldBeginInternalWithName:_boolFieldName
-                                              type:_boolFieldType.intValue
-                                           fieldID:_boolFieldId.intValue
-                                      typeOverride:b ? TCType_BOOLEAN_TRUE : TCType_BOOLEAN_FALSE
-                                             error:error];
-    _boolFieldId = nil;
-    _boolFieldName = nil;
-    _boolFieldType = nil;
-  }
-  else {
-    // we're not part of a field, so just Write the value.
-    result = [self writeByteDirect:b ? TCType_BOOLEAN_TRUE : TCType_BOOLEAN_FALSE error:error];
-  }
-  return result;
-}
-
--(BOOL) writeByte:(UInt8)value error:(NSError *__autoreleasing *)error
-{
-  return [self writeByteDirect:value error:error];
-}
-
--(BOOL) writeI16:(SInt16)value error:(NSError *__autoreleasing *)error
-{
-  return [self writeVarint32:[self i32ToZigZag:value] error:error];
-}
-
--(BOOL) writeI32:(SInt32)value error:(NSError *__autoreleasing *)error
-{
-  return [self writeVarint32:[self i32ToZigZag:value] error:error];
-}
-
--(BOOL) writeI64:(SInt64)value error:(NSError *__autoreleasing *)error
-{
-  return [self writeVarint64:[self i64ToZigZag:value] error:error];
-}
-
--(BOOL) writeDouble:(double)value error:(NSError *__autoreleasing *)error
-{
-  // Safe bit-casting double->uint64
-
-  UInt64 bits = 0;
-  memcpy(&bits, &value, 8);
-
-  bits = OSSwapHostToLittleInt64(bits);
-
-  if (![_transport write:(UInt8 *)&bits offset:0 length:8 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-
-  return YES;
-}
-
--(BOOL) writeString:(NSString *)value error:(NSError *__autoreleasing *)error
-{
-  return [self writeBinary:[value dataUsingEncoding:NSUTF8StringEncoding] error:error];
-}
-
--(BOOL) writeBinary:(NSData *)data error:(NSError *__autoreleasing *)error
-{
-  if (![self writeVarint32:(UInt32)data.length error:error]) {
-    return NO;
-  }
-  if (![_transport write:data.bytes offset:0 length:(UInt32)data.length error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-  return YES;
-}
-
--(BOOL) writeMessageEnd:(NSError *__autoreleasing *)error
-{
-  _currentMessageName = nil;
-  return YES;
-}
-
--(BOOL) writeMapEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
--(BOOL) writeListEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
--(BOOL) writeSetEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
--(BOOL) writeFieldEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
--(BOOL) writeCollectionBeginWithElementType:(SInt32)elementType
-                                       size:(SInt32)size
-                                      error:(NSError *__autoreleasing *)error
-{
-  UInt8 ctypeElement = [self compactTypeForTType:elementType];
-
-  if (size <= 14) {
-    if (![self writeByteDirect:size << 4 | ctypeElement error:error]) {
-      return NO;
-    }
-  }
-  else {
-    if (![self writeByteDirect:0xf0 | ctypeElement error:error]) {
-      return NO;
-    }
-    if (![self writeVarint32:(UInt32)size error:error]) {
-      return NO;
-    }
-  }
-  return YES;
-}
-
--(BOOL) writeVarint64:(UInt64)n error:(NSError *__autoreleasing *)error
-{
-  UInt8 varint64out[10] = {0};
-  int idx = 0;
-
-  while (true) {
-    if ((n & ~0x7FL) == 0) {
-      varint64out[idx++] = (UInt8)n;
-      break;
-    }
-    else {
-      varint64out[idx++] = (UInt8)((n & 0x7F) | 0x80);
-      n >>= 7;
-    }
-  }
-
-  if (![_transport write:varint64out offset:0 length:idx error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport write failed");
-  }
-
-  return YES;
-}
-
--(UInt32) i32ToZigZag:(SInt32)n
-{
-  /*
-     ZigZag encoding maps signed integers to unsigned integers so that
-     numbers with a small absolute value (for instance, -1) have
-     a small varint encoded value too. It does this in a way that
-     "zig-zags" back and forth through the positive and negative integers,
-     so that -1 is encoded as 1, 1 is encoded as 2, -2 is encoded as 3, and so
-         on
-   */
-  return (UInt32)(n << 1) ^ (UInt32)(n >> 31);
-}
-
--(UInt64) i64ToZigZag:(SInt64)n
-{
-  return (UInt64)(n << 1) ^ (UInt64)(n >> 63);
-}
-
--(BOOL) readMessageBeginReturningName:(NSString **)pname
-                                 type:(SInt32 *)ptype
-                           sequenceID:(SInt32 *)psequenceID
-                                error:(NSError *__autoreleasing *)error
-{
-  UInt8 protocolId;
-  if (![self readByte:&protocolId error:error]) {
-    return NO;
-  }
-
-  if (protocolId != COMPACT_PROTOCOL_ID) {
-    if (error) {
-      *error = [NSError errorWithDomain:TProtocolErrorDomain
-                                   code:TProtocolErrorUnknown
-                               userInfo:@{TProtocolErrorExtendedErrorKey: @(TProtocolExtendedErrorMismatchedProtocol),
-                                          TProtocolErrorExpectedIdKey: @(COMPACT_PROTOCOL_ID)}];
-    }
-    return NO;
-  }
-
-  UInt8 versionAndType;
-  if (![self readByte:&versionAndType error:error]) {
-    return NO;
-  }
-
-  UInt8 version = versionAndType & COMPACT_VERSION_MASK;
-  if (version != COMPACT_VERSION) {
-    if (error) {
-      *error = [NSError errorWithDomain:TProtocolErrorDomain
-                                   code:TProtocolErrorBadVersion
-                               userInfo:@{TProtocolErrorExpectedVersionKey: @(COMPACT_VERSION)}];
-    }
-    return NO;
-  }
-
-  int type = (versionAndType >> COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_BITS;
-  UInt32 sequenceID;
-  if (![self readVarint32:&sequenceID error:error]) {
-    return NO;
-  }
-  NSString *name;
-  if (![self readString:&name error:error]) {
-    return NO;
-  }
-
-  if (ptype != NULL) {
-    *ptype = type;
-  }
-  if (psequenceID != NULL) {
-    *psequenceID = sequenceID;
-  }
-  if (pname != NULL) {
-    *pname = name;
-  }
-  return YES;
-}
-
--(BOOL) readStructBeginReturningName:(NSString **)pname error:(NSError *__autoreleasing *)error
-{
-  [_lastField addObject:@(_lastFieldId)];
-  _lastFieldId = 0;
-
-  if (pname != NULL) {
-    *pname = @"";
-  }
-
-  return YES;
-}
-
--(BOOL) readStructEnd:(NSError *__autoreleasing *)error
-{
-  _lastFieldId = [_lastField.lastObject shortValue];
-  [_lastField removeLastObject];
-  return YES;
-}
-
--(BOOL) readFieldBeginReturningName:(NSString **)pname
-                               type:(SInt32 *)pfieldType
-                            fieldID:(SInt32 *)pfieldID
-                              error:(NSError *__autoreleasing *)error
-{
-  UInt8 byte;
-  if (![self readByte:&byte error:error]) {
-    return NO;
-  }
-
-  UInt8 type = byte & 0x0f;
-
-  // if it's a stop, then we can return immediately, as the struct is over.
-  if (type == TCType_STOP) {
-    if (pname != NULL) {
-      *pname = @"";
-    }
-    if (pfieldType != NULL) {
-      *pfieldType = TTypeSTOP;
-    }
-    if (pfieldID != NULL) {
-      *pfieldID = 0;
-    }
-    return YES;
-  }
-
-  short fieldId = 0;
-
-  // mask off the 4 MSB of the type header. it could contain a field id delta.
-  short modifier = (byte & 0xf0) >> 4;
-  if (modifier == 0) {
-    // not a delta. look ahead for the zigzag varint field id.
-    if (![self readI16:&fieldId error:error]) {
-      return NO;
-    }
-  }
-  else {
-    // has a delta. add the delta to the last Read field id.
-    fieldId = _lastFieldId + modifier;
-  }
-
-  UInt8 fieldType;
-  if (![self ttype:&fieldType forCompactType:type error:error]) {
-    return NO;
-  }
-
-  if (pname != NULL) {
-    *pname = @"";
-  }
-  if (pfieldType != NULL) {
-    *pfieldType = fieldType;
-  }
-  if (pfieldID != NULL) {
-    *pfieldID = fieldId;
-  }
-
-  // if this happens to be a boolean field, the value is encoded in the type
-  if (type == TCType_BOOLEAN_TRUE ||
-      type == TCType_BOOLEAN_FALSE)
-  {
-    // save the boolean value in a special instance variable.
-    _booleanValue = [NSNumber numberWithBool:type == TCType_BOOLEAN_TRUE];
-  }
-
-  // push the new field onto the field stack so we can keep the deltas going.
-  _lastFieldId = fieldId;
-
-  return YES;
-}
-
--(BOOL) readMapBeginReturningKeyType:(SInt32 *)pkeyType
-                           valueType:(SInt32 *)pvalueType
-                                size:(SInt32 *)psize
-                               error:(NSError *__autoreleasing *)error
-{
-  UInt8 keyAndValueType = 0;
-  UInt32 size;
-  if (![self readVarint32:&size error:error]) {
-    return NO;
-  }
-  if (size != 0) {
-    if (![self readByte:&keyAndValueType error:error]) {
-      return NO;
-    }
-  }
-
-  UInt8 keyType;
-  if (![self ttype:&keyType forCompactType:keyAndValueType >> 4 error:error]) {
-    return NO;
-  }
-
-  UInt8 valueType;
-  if (![self ttype:&valueType forCompactType:keyAndValueType & 0xf error:error]) {
-    return NO;
-  }
-
-  if (pkeyType != NULL) {
-    *pkeyType = keyType;
-  }
-  if (pvalueType != NULL) {
-    *pvalueType = valueType;
-  }
-  if (psize != NULL) {
-    *psize = size;
-  }
-
-  return YES;
-}
-
--(BOOL) readListBeginReturningElementType:(SInt32 *)pelementType
-                                     size:(SInt32 *)psize
-                                    error:(NSError *__autoreleasing *)error
-{
-  UInt8 sizeAndType;
-  if (![self readByte:&sizeAndType error:error]) {
-    return NO;
-  }
-
-  UInt32 size = (sizeAndType >> 4) & 0x0f;
-  if (size == 15) {
-    if (![self readVarint32:&size error:error]) {
-      return NO;
-    }
-  }
-
-  UInt8 elementType;
-  if (![self ttype:&elementType forCompactType:sizeAndType & 0x0f error:error]) {
-    return NO;
-  }
-
-  if (pelementType != NULL) {
-    *pelementType = elementType;
-  }
-  if (psize != NULL) {
-    *psize = size;
-  }
-
-  return YES;
-}
-
--(BOOL) readSetBeginReturningElementType:(SInt32 *)pelementType
-                                    size:(SInt32 *)psize
-                                   error:(NSError *__autoreleasing *)error
-{
-  return [self readListBeginReturningElementType:pelementType size:psize error:error];
-}
-
--(BOOL) readBool:(BOOL *)value error:(NSError *__autoreleasing *)error
-{
-  if (_booleanValue != nil) {
-
-    BOOL result = _booleanValue.boolValue;
-    _booleanValue = nil;
-
-    *value = result;
-  }
-  else {
-
-    UInt8 result;
-    if (![self readByte:&result error:error]) {
-      return NO;
-    }
-
-    *value = result == TCType_BOOLEAN_TRUE;
-  }
-
-  return YES;
-}
-
--(BOOL) readByte:(UInt8 *)value error:(NSError *__autoreleasing *)error
-{
-  if (![_transport readAll:value offset:0 length:1 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-  }
-  return YES;
-}
-
--(BOOL) readI16:(SInt16 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt32 v;
-  if (![self readVarint32:&v error:error]) {
-    return NO;
-  }
-
-  if (value) {
-    *value = (SInt16)[self zigZagToi32:v];
-  }
-
-  return YES;
-}
-
--(BOOL) readI32:(SInt32 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt32 v;
-  if (![self readVarint32:&v error:error]) {
-    return NO;
-  }
-
-  if (value) {
-    *value = [self zigZagToi32:v];
-  }
-
-  return YES;
-}
-
--(BOOL) readI64:(SInt64 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt64 v;
-  if (![self readVarint64:&v error:error]) {
-    return NO;
-  }
-
-  if (value) {
-    *value = [self zigZagToi64:v];
-  }
-
-  return YES;
-}
-
--(BOOL) readDouble:(double *)value error:(NSError *__autoreleasing *)error
-{
-  UInt64 bits;
-  if (![_transport readAll:(UInt8 *)&bits offset:0 length:8 error:error]) {
-    PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-  }
-
-  bits = OSSwapLittleToHostInt64(bits);
-
-  if (value) {
-    memcpy(value, &bits, sizeof(bits));
-  }
-
-  return YES;
-}
-
--(BOOL) readString:(NSString *__autoreleasing *)value error:(NSError *__autoreleasing *)error
-{
-  UInt32 length;
-  if (![self readVarint32:&length error:error]) {
-    return NO;
-  }
-
-  NSString *result;
-
-  if (length != 0) {
-
-    NSData *data;
-    if (![self readBinaryOfLength:length data:&data error:error]) {
-      return NO;
-    }
-
-    result = [[NSString alloc] initWithData:data
-                                   encoding:NSUTF8StringEncoding];
-  }
-  else {
-    result = @"";
-  }
-
-  if (value) {
-    *value = result;
-  }
-
-  return YES;
-}
-
--(BOOL) readBinary:(NSData *__autoreleasing *)value error:(NSError *__autoreleasing *)error
-{
-  UInt32 length;
-  if (![self readVarint32:&length error:error]) {
-    return NO;
-  }
-
-  return [self readBinaryOfLength:length data:value error:error];
-}
-
--(BOOL) readBinaryOfLength:(UInt32)length data:(NSData *__autoreleasing *)value error:(NSError *__autoreleasing *)error
-{
-  NSData *result;
-
-  if (length != 0) {
-
-    NSMutableData *buf = [NSMutableData dataWithLength:length];
-    if (![_transport readAll:buf.mutableBytes offset:0 length:length error:error]) {
-      PROTOCOL_TRANSPORT_ERROR(NO, error, @"Transport read failed");
-    }
-
-    result = buf;
-  }
-  else {
-
-    result = [NSData data];
-
-  }
-
-  if (value) {
-    *value = result;
-  }
-
-  return YES;
-}
-
--(BOOL) readMessageEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
--(BOOL) readFieldEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
--(BOOL) readMapEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
--(BOOL) readListEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
--(BOOL) readSetEnd:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
--(BOOL) readVarint32:(UInt32 *)value error:(NSError *__autoreleasing *)error
-{
-  UInt32 result = 0;
-  int shift = 0;
-
-  while (true) {
-
-    UInt8 byte;
-    if (![self readByte:&byte error:error]) {
-      return NO;
-    }
-
-    result |= (UInt32)(byte & 0x7f) << shift;
-    if (!(byte & 0x80)) {
-      break;
-    }
-
-    shift += 7;
-  }
-
-  if (value) {
-    *value = result;
-  }
-
-  return YES;
-}
-
--(BOOL) readVarint64:(UInt64 *)value error:(NSError *__autoreleasing *)error
-{
-  int shift = 0;
-  UInt64 result = 0;
-
-  while (true) {
-
-    UInt8 byte;
-    if (![self readByte:&byte error:error]) {
-      return NO;
-    }
-
-    result |= (UInt64)(byte & 0x7f) << shift;
-    if (!(byte & 0x80)) {
-      break;
-    }
-
-    shift += 7;
-  }
-
-  if (value) {
-    *value = result;
-  }
-
-  return YES;
-}
-
--(SInt32) zigZagToi32:(UInt32)n
-{
-  return (SInt32)(n >> 1) ^ (-(SInt32)(n & 1));
-}
-
--(SInt64) zigZagToi64:(UInt64)n
-{
-  return (SInt64)(n >> 1) ^ (-(SInt64)(n & 1));
-}
-
--(BOOL) ttype:(UInt8 *)ttype forCompactType:(UInt8)ctype error:(NSError *__autoreleasing *)error
-{
-  switch (ctype & 0x0f) {
-  case TCType_STOP:
-    *ttype = TTypeSTOP;
-    return YES;
-
-  case TCType_BOOLEAN_FALSE:
-  case TCType_BOOLEAN_TRUE:
-    *ttype = TTypeBOOL;
-    return YES;
-
-  case TCType_BYTE:
-    *ttype = TTypeBYTE;
-    return YES;
-
-  case TCType_I16:
-    *ttype = TTypeI16;
-    return YES;
-
-  case TCType_I32:
-    *ttype = TTypeI32;
-    return YES;
-
-  case TCType_I64:
-    *ttype = TTypeI64;
-    return YES;
-
-  case TCType_DOUBLE:
-    *ttype = TTypeDOUBLE;
-    return YES;
-
-  case TCType_BINARY:
-    *ttype = TTypeSTRING;
-    return YES;
-
-  case TCType_LIST:
-    *ttype = TTypeLIST;
-    return YES;
-
-  case TCType_SET:
-    *ttype = TTypeSET;
-    return YES;
-
-  case TCType_MAP:
-    *ttype = TTypeMAP;
-    return YES;
-
-  case TCType_STRUCT:
-    *ttype = TTypeSTRUCT;
-    return YES;
-
-  default:
-    if (error) {
-      *error = [NSError errorWithDomain:TProtocolErrorDomain
-                                   code:TProtocolErrorUnknown
-                               userInfo:@{TProtocolErrorTypeKey: @((UInt8)(ctype & 0x0F))}];
-    }
-    return NO;
-  }
-}
-
--(UInt8) compactTypeForTType:(UInt8)ttype
-{
-  static UInt8 ttypeToCompactType[] = {
-    [TTypeSTOP] = TCType_STOP,
-    [TTypeBOOL] = TCType_BOOLEAN_FALSE,
-    [TTypeBYTE] = TCType_BYTE,
-    [TTypeDOUBLE] = TCType_DOUBLE,
-    [TTypeI16] = TCType_I16,
-    [TTypeI32] = TCType_I32,
-    [TTypeI64] = TCType_I64,
-    [TTypeSTRING] = TCType_BINARY,
-    [TTypeSTRUCT] = TCType_STRUCT,
-    [TTypeMAP] = TCType_MAP,
-    [TTypeSET] = TCType_SET,
-    [TTypeLIST] = TCType_LIST
-  };
-
-  return ttypeToCompactType[ttype];
-}
-
-@end
diff --git a/lib/cocoa/src/protocol/TMultiplexedProtocol.h b/lib/cocoa/src/protocol/TMultiplexedProtocol.h
deleted file mode 100644
index b8ce361..0000000
--- a/lib/cocoa/src/protocol/TMultiplexedProtocol.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "TProtocolDecorator.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-extern NSString *TMultiplexedProtocolSeperator;
-
-
-@interface TMultiplexedProtocol : TProtocolDecorator
-
--(id) initWithProtocol:(id <TProtocol>)protocol
-           serviceName:(NSString *)name;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
\ No newline at end of file
diff --git a/lib/cocoa/src/protocol/TMultiplexedProtocol.m b/lib/cocoa/src/protocol/TMultiplexedProtocol.m
deleted file mode 100644
index 5838c57..0000000
--- a/lib/cocoa/src/protocol/TMultiplexedProtocol.m
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TMultiplexedProtocol.h"
-
-#import "TProtocol.h"
-
-NSString *TMultiplexedProtocolSeperator = @":";
-
-
-@interface TMultiplexedProtocol ()
-
-@property(strong, nonatomic) NSString *serviceName;
-
-@end
-
-
-@implementation TMultiplexedProtocol
-
--(id) initWithProtocol:(id <TProtocol>)protocol
-           serviceName:(NSString *)name
-{
-  self = [super initWithProtocol:protocol];
-  if (self) {
-    _serviceName = name;
-  }
-  return self;
-}
-
--(BOOL) writeMessageBeginWithName:(NSString *)name
-                             type:(SInt32)messageType
-                       sequenceID:(SInt32)sequenceID
-                            error:(NSError *__autoreleasing *)error
-{
-  switch (messageType) {
-  case TMessageTypeCALL:
-  case TMessageTypeONEWAY: {
-    NSMutableString *serviceFunction = [[NSMutableString alloc] initWithString:_serviceName];
-    [serviceFunction appendString:TMultiplexedProtocolSeperator];
-    [serviceFunction appendString:name];
-    return [super writeMessageBeginWithName:serviceFunction type:messageType sequenceID:sequenceID error:error];
-  }
-  break;
-
-  default:
-    return [super writeMessageBeginWithName:name type:messageType sequenceID:sequenceID error:error];
-  }
-}
-
-@end
diff --git a/lib/cocoa/src/protocol/TProtocol.h b/lib/cocoa/src/protocol/TProtocol.h
deleted file mode 100644
index 841059f..0000000
--- a/lib/cocoa/src/protocol/TProtocol.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "TTransport.h"
-
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-typedef NS_ENUM (int, TMessageType) {
-  TMessageTypeCALL = 1,
-  TMessageTypeREPLY = 2,
-  TMessageTypeEXCEPTION = 3,
-  TMessageTypeONEWAY = 4
-};
-
-typedef NS_ENUM (int, TType) {
-  TTypeSTOP   = 0,
-  TTypeVOID   = 1,
-  TTypeBOOL   = 2,
-  TTypeBYTE   = 3,
-  TTypeDOUBLE = 4,
-  TTypeI16    = 6,
-  TTypeI32    = 8,
-  TTypeI64    = 10,
-  TTypeSTRING = 11,
-  TTypeSTRUCT = 12,
-  TTypeMAP    = 13,
-  TTypeSET    = 14,
-  TTypeLIST   = 15
-};
-
-
-@protocol TProtocol <NSObject>
-
--(id <TTransport>) transport;
-
--(BOOL) readMessageBeginReturningName:(NSString *__nullable __autoreleasing *__nullable)name
-                                 type:(nullable SInt32 *)type
-                           sequenceID:(nullable SInt32 *)sequenceID
-                                error:(NSError *__autoreleasing *)error;
--(BOOL) readMessageEnd:(NSError *__autoreleasing *)error;
-
--(BOOL) readStructBeginReturningName:(NSString *__nullable __autoreleasing *__nullable)name
-                               error:(NSError *__autoreleasing *)error;
--(BOOL) readStructEnd:(NSError *__autoreleasing *)error;
-
--(BOOL) readFieldBeginReturningName:(NSString *__nullable __autoreleasing *__nullable)name
-                               type:(SInt32 *)fieldType
-                            fieldID:(nullable SInt32 *)fieldID
-                              error:(NSError *__autoreleasing *)error;
--(BOOL) readFieldEnd:(NSError *__autoreleasing *)error;
-
--(BOOL) readString:(NSString *__nonnull __autoreleasing *__nonnull)value error:(NSError **)error;
-
--(BOOL) readBool:(BOOL *)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) readByte:(UInt8 *)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) readI16:(SInt16 *)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) readI32:(SInt32 *)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) readI64:(SInt64 *)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) readDouble:(double *)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) readBinary:(NSData *__nonnull __autoreleasing *__nonnull)value error:(NSError **)error;
-
--(BOOL) readMapBeginReturningKeyType:(nullable SInt32 *)keyType
-                           valueType:(nullable SInt32 *)valueType
-                                size:(SInt32 *)size
-                               error:(NSError *__autoreleasing *)error;
--(BOOL) readMapEnd:(NSError *__autoreleasing *)error;
-
-
--(BOOL) readSetBeginReturningElementType:(nullable SInt32 *)elementType
-                                    size:(SInt32 *)size
-                                   error:(NSError *__autoreleasing *)error;
--(BOOL) readSetEnd:(NSError *__autoreleasing *)error;
-
-
--(BOOL) readListBeginReturningElementType:(nullable SInt32 *)elementType
-                                     size:(SInt32 *)size
-                                    error:(NSError *__autoreleasing *)error;
--(BOOL) readListEnd:(NSError *__autoreleasing *)error;
-
-
--(BOOL) writeMessageBeginWithName:(NSString *)name
-                             type:(SInt32)messageType
-                       sequenceID:(SInt32)sequenceID
-                            error:(NSError *__autoreleasing *)error;
--(BOOL) writeMessageEnd:(NSError *__autoreleasing *)error;
-
--(BOOL) writeStructBeginWithName:(NSString *)name error:(NSError **)error;
--(BOOL) writeStructEnd:(NSError *__autoreleasing *)error;
-
--(BOOL) writeFieldBeginWithName:(NSString *)name
-                           type:(SInt32)fieldType
-                        fieldID:(SInt32)fieldID
-                          error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeI32:(SInt32)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeI64:(SInt64)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeI16:(short)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeByte:(UInt8)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeString:(NSString *)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeDouble:(double)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeBool:(BOOL)value error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeBinary:(NSData *)data error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeFieldStop:(NSError *__autoreleasing *)error;
-
--(BOOL) writeFieldEnd:(NSError *__autoreleasing *)error;
-
--(BOOL) writeMapBeginWithKeyType:(SInt32)keyType
-                       valueType:(SInt32)valueType
-                            size:(SInt32)size
-                           error:(NSError *__autoreleasing *)error;
--(BOOL) writeMapEnd:(NSError *__autoreleasing *)error;
-
-
--(BOOL) writeSetBeginWithElementType:(SInt32)elementType
-                                size:(SInt32)size
-                               error:(NSError *__autoreleasing *)error;
--(BOOL) writeSetEnd:(NSError *__autoreleasing *)error;
-
-
--(BOOL) writeListBeginWithElementType:(SInt32)elementType
-                                 size:(SInt32)size
-                                error:(NSError *__autoreleasing *)error;
-
--(BOOL) writeListEnd:(NSError *__autoreleasing *)error;
-
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/protocol/TProtocolDecorator.h b/lib/cocoa/src/protocol/TProtocolDecorator.h
deleted file mode 100644
index 369b6a2..0000000
--- a/lib/cocoa/src/protocol/TProtocolDecorator.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "TProtocol.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TProtocolDecorator : NSObject <TProtocol>
-
--(id) initWithProtocol:(id <TProtocol>)protocol;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
\ No newline at end of file
diff --git a/lib/cocoa/src/protocol/TProtocolDecorator.m b/lib/cocoa/src/protocol/TProtocolDecorator.m
deleted file mode 100644
index 218f900..0000000
--- a/lib/cocoa/src/protocol/TProtocolDecorator.m
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocolDecorator.h"
-
-
-@interface TProtocolDecorator ()
-
-@property(strong, nonatomic) id<TProtocol> concreteProtocol;
-
-@end
-
-
-@implementation TProtocolDecorator
-
--(id) initWithProtocol:(id <TProtocol>)protocol
-{
-  self = [super init];
-  if (self) {
-    _concreteProtocol = protocol;
-  }
-  return self;
-}
-
--(id <TTransport>) transport
-{
-  return [_concreteProtocol transport];
-}
-
--(BOOL) readMessageBeginReturningName:(NSString **)name
-                                 type:(SInt32 *)type
-                           sequenceID:(SInt32 *)sequenceID
-                                error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readMessageBeginReturningName:name
-                                                     type:type
-                                               sequenceID:sequenceID
-                                                    error:error];
-}
-
--(BOOL) readMessageEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readMessageEnd:error];
-}
-
--(BOOL) readStructBeginReturningName:(NSString **)name
-                               error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readStructBeginReturningName:name error:error];
-}
-
--(BOOL) readStructEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readStructEnd:error];
-}
-
--(BOOL) readFieldBeginReturningName:(NSString **)name
-                               type:(SInt32 *)fieldType
-                            fieldID:(SInt32 *)fieldID
-                              error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readFieldBeginReturningName:name
-                                                   type:fieldType
-                                                fieldID:fieldID
-                                                  error:error];
-}
--(BOOL) readFieldEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readFieldEnd:error];
-}
-
--(BOOL) readString:(NSString *__autoreleasing *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readString:value error:error];
-}
-
--(BOOL) readBool:(BOOL *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readBool:value error:error];
-}
-
--(BOOL) readByte:(UInt8 *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readByte:value error:error];
-}
-
--(BOOL) readI16:(SInt16 *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readI16:value error:error];
-}
-
--(BOOL) readI32:(SInt32 *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readI32:value error:error];
-}
-
--(BOOL) readI64:(SInt64 *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readI64:value error:error];
-}
-
--(BOOL) readDouble:(double *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readDouble:value error:error];
-}
-
--(BOOL) readBinary:(NSData *__autoreleasing *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readBinary:value error:error];
-}
-
--(BOOL) readMapBeginReturningKeyType:(SInt32 *)keyType
-                           valueType:(SInt32 *)valueType
-                                size:(SInt32 *)size
-                               error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readMapBeginReturningKeyType:keyType
-                                               valueType:valueType
-                                                    size:size
-                                                   error:error];
-}
--(BOOL) readMapEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readMapEnd:error];
-}
-
-
--(BOOL) readSetBeginReturningElementType:(SInt32 *)elementType
-                                    size:(SInt32 *)size
-                                   error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readSetBeginReturningElementType:elementType
-                                                        size:size
-                                                       error:error];
-}
--(BOOL) readSetEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readSetEnd:error];
-}
-
--(BOOL) readListBeginReturningElementType:(SInt32 *)elementType
-                                     size:(SInt32 *)size
-                                    error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readListBeginReturningElementType:elementType
-                                                         size:size
-                                                        error:error];
-}
--(BOOL) readListEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol readListEnd:error];
-}
-
--(BOOL) writeMessageBeginWithName:(NSString *)name
-                             type:(SInt32)messageType
-                       sequenceID:(SInt32)sequenceID
-                            error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeMessageBeginWithName:name
-                                                 type:messageType
-                                           sequenceID:sequenceID
-                                                error:error];
-}
--(BOOL) writeMessageEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeMessageEnd:error];
-}
-
--(BOOL) writeStructBeginWithName:(NSString *)name error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeStructBeginWithName:name error:error];
-}
--(BOOL) writeStructEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeStructEnd:error];
-}
-
--(BOOL) writeFieldBeginWithName:(NSString *)name
-                           type:(SInt32)fieldType
-                        fieldID:(SInt32)fieldID
-                          error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeFieldBeginWithName:name
-                                               type:fieldType
-                                            fieldID:fieldID
-                                              error:error];
-}
-
--(BOOL) writeI32:(SInt32)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeI32:value error:error];
-}
-
--(BOOL) writeI64:(SInt64)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeI64:value error:error];
-}
-
--(BOOL) writeI16:(SInt16)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeI16:value error:error];
-}
-
--(BOOL) writeByte:(UInt8)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeByte:value error:error];
-}
-
--(BOOL) writeString:(NSString *)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeString:value error:error];
-}
-
--(BOOL) writeDouble:(double)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeDouble:value error:error];
-}
-
--(BOOL) writeBool:(BOOL)value error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeBool:value error:error];
-}
-
--(BOOL) writeBinary:(NSData *)data error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeBinary:data error:error];
-}
-
--(BOOL) writeFieldStop:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeFieldStop:error];
-}
-
--(BOOL) writeFieldEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeFieldEnd:error];
-}
-
--(BOOL) writeMapBeginWithKeyType:(SInt32)keyType
-                       valueType:(SInt32)valueType
-                            size:(SInt32)size
-                           error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeMapBeginWithKeyType:keyType
-                                           valueType:valueType
-                                                size:size
-                                               error:error];
-}
-
--(BOOL) writeMapEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeMapEnd:error];
-}
-
--(BOOL) writeSetBeginWithElementType:(SInt32)elementType
-                                size:(SInt32)size
-                               error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeSetBeginWithElementType:elementType size:size error:error];
-}
-
--(BOOL) writeSetEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeSetEnd:error];
-}
-
--(BOOL) writeListBeginWithElementType:(SInt32)elementType
-                                 size:(SInt32)size
-                                error:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeListBeginWithElementType:elementType size:size error:error];
-}
-
--(BOOL) writeListEnd:(NSError *__autoreleasing *)error
-{
-  return [_concreteProtocol writeListEnd:error];
-}
-
-@end
diff --git a/lib/cocoa/src/protocol/TProtocolError.h b/lib/cocoa/src/protocol/TProtocolError.h
deleted file mode 100644
index ab0bc40..0000000
--- a/lib/cocoa/src/protocol/TProtocolError.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TError.h"
-
-
-extern NSString *TProtocolErrorDomain;
-
-typedef NS_ENUM (int, TProtocolError) {
-  TProtocolErrorUnknown                   = 0,
-  TProtocolErrorInvalidData               = 1,
-  TProtocolErrorNegativeSize              = 2,
-  TProtocolErrorSizeLimit                 = 3,
-  TProtocolErrorBadVersion                = 4,
-  TProtocolErrorNotImplemented            = 5,
-  TProtocolErrorDepthLimit                = 6,
-};
-
-
-typedef NS_ENUM(int, TProtocolExtendedError) {
-  TProtocolExtendedErrorMissingRequiredField  = 1001,
-  TProtocolExtendedErrorUnexpectedType        = 1002,
-  TProtocolExtendedErrorMismatchedProtocol    = 1003,
-};
-
-extern NSString *TProtocolErrorExtendedErrorKey;
-extern NSString *TProtocolErrorFieldNameKey;
-extern NSString *TProtocolErrorExpectedIdKey;
-extern NSString *TProtocolErrorExpectedVersionKey;
-extern NSString *TProtocolErrorTypeKey;
-extern NSString *TProtocolErrorSourceLineKey;
-extern NSString *TProtocolErrorSourceFileKey;
-extern NSString *TProtocolErrorSourceMethodKey;
-extern NSString *TProtocolErrorMessageNameKey;
-
-
-#define PROTOCOL_ERROR(ret, err, ...) \
-  if (error) {  \
-    *error = [NSError errorWithDomain:TProtocolErrorDomain \
-                                 code:TProtocolError ## err \
-                             userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:__VA_ARGS__], \
-                                        @"SourceFile": [NSString stringWithUTF8String:__FILE__], \
-                                        @"SourceLine": @(__LINE__), \
-                                        @"SourceFunction": [NSString stringWithUTF8String:__PRETTY_FUNCTION__], \
-                                        @"Message": self.currentMessageName ? self.currentMessageName : @""}]; \
-  } \
-  return ret
-
-#define PROTOCOL_TRANSPORT_ERROR(ret, errorPtr, ...) \
-  if (errorPtr) { \
-    *error = [NSError errorWithDomain:TProtocolErrorDomain \
-                                 code:TProtocolErrorUnknown \
-                             userInfo:@{NSLocalizedDescriptionKey: [[NSString stringWithFormat:__VA_ARGS__] stringByAppendingFormat:@": %@", [(*errorPtr) localizedDescription]], \
-                                        TProtocolErrorSourceFileKey: [NSString stringWithUTF8String:__FILE__], \
-                                        TProtocolErrorSourceLineKey: @(__LINE__), \
-                                        TProtocolErrorSourceMethodKey: [NSString stringWithUTF8String:__PRETTY_FUNCTION__], \
-                                        TProtocolErrorMessageNameKey: self.currentMessageName ? self.currentMessageName : @"", \
-                                        NSUnderlyingErrorKey: *errorPtr}]; \
-  } \
-  return ret
diff --git a/lib/cocoa/src/protocol/TProtocolError.m b/lib/cocoa/src/protocol/TProtocolError.m
deleted file mode 100644
index 953673b..0000000
--- a/lib/cocoa/src/protocol/TProtocolError.m
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocolError.h"
-
-
-NSString *TProtocolErrorDomain = @"TProtocolErrorDomain";
-
-NSString *TProtocolErrorExtendedErrorKey = @"extendedError";
-NSString *TProtocolErrorFieldNameKey = @"field";
-NSString *TProtocolErrorExpectedIdKey = @"expectedId";
-NSString *TProtocolErrorExpectedVersionKey = @"expectedVersion";
-NSString *TProtocolErrorTypeKey = @"type";
-NSString *TProtocolErrorSourceLineKey = @"sourceLine";
-NSString *TProtocolErrorSourceFileKey = @"sourceFile";
-NSString *TProtocolErrorSourceMethodKey = @"sourceMethod";
-NSString *TProtocolErrorMessageNameKey = @"messageName";
diff --git a/lib/cocoa/src/protocol/TProtocolFactory.h b/lib/cocoa/src/protocol/TProtocolFactory.h
deleted file mode 100644
index a022a7f..0000000
--- a/lib/cocoa/src/protocol/TProtocolFactory.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProtocol.h"
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@protocol TProtocolFactory <NSObject>
-
-@property (readonly, nonatomic) NSString *protocolName;
-
--(id<TProtocol>) newProtocolOnTransport:(id<TTransport>)transport;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/protocol/TProtocolUtil.h b/lib/cocoa/src/protocol/TProtocolUtil.h
deleted file mode 100644
index 82510cf..0000000
--- a/lib/cocoa/src/protocol/TProtocolUtil.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TProtocolUtil : NSObject
-
-+(BOOL) skipType:(int)type onProtocol:(id <TProtocol>)protocol error:(NSError **)error;
-
-@end;
-
-
-NS_ASSUME_NONNULL_END
\ No newline at end of file
diff --git a/lib/cocoa/src/protocol/TProtocolUtil.m b/lib/cocoa/src/protocol/TProtocolUtil.m
deleted file mode 100644
index c0d65ac..0000000
--- a/lib/cocoa/src/protocol/TProtocolUtil.m
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocolUtil.h"
-
-@implementation TProtocolUtil
-
-+(BOOL) skipType:(int)type onProtocol:(id <TProtocol>)protocol error:(NSError **)error
-{
-  switch (type) {
-  case TTypeBOOL: {
-    BOOL val;
-    if (![protocol readBool:&val error:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeBYTE: {
-    UInt8 val;
-    if (![protocol readByte:&val error:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeI16: {
-    SInt16 val;
-    if (![protocol readI16:&val error:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeI32: {
-    SInt32 val;
-    if (![protocol readI32:&val error:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeI64: {
-    SInt64 val;
-    if (![protocol readI64:&val error:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeDOUBLE: {
-    double val;
-    if (![protocol readDouble:&val error:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeSTRING: {
-    NSString *val;
-    if (![protocol readString:&val error:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeSTRUCT: {
-    if (![protocol readStructBeginReturningName:NULL error:error]) {
-      return NO;
-    }
-    while (true) {
-      SInt32 fieldType;
-      if (![protocol readFieldBeginReturningName:nil type:&fieldType fieldID:nil error:error]) {
-        return NO;
-      }
-      if (fieldType == TTypeSTOP) {
-        break;
-      }
-      if (![self skipType:fieldType onProtocol:protocol error:error]) {
-        return NO;
-      }
-      if (![protocol readFieldEnd:error]) {
-        return NO;
-      }
-    }
-    if (![protocol readStructEnd:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeMAP: {
-    SInt32 keyType;
-    SInt32 valueType;
-    SInt32 size;
-    if (![protocol readMapBeginReturningKeyType:&keyType valueType:&valueType size:&size error:error]) {
-      return NO;
-    }
-    int i;
-    for (i = 0; i < size; i++) {
-      if (![TProtocolUtil skipType:keyType onProtocol:protocol error:error]) {
-        return NO;
-      }
-      if (![TProtocolUtil skipType:valueType onProtocol:protocol error:error]) {
-        return NO;
-      }
-    }
-    if (![protocol readMapEnd:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeSET: {
-    SInt32 elemType;
-    SInt32 size;
-    if (![protocol readSetBeginReturningElementType:&elemType size:&size error:error]) {
-      return NO;
-    }
-    int i;
-    for (i = 0; i < size; i++) {
-      if (![TProtocolUtil skipType:elemType onProtocol:protocol error:error]) {
-        return NO;
-      }
-    }
-    if (![protocol readSetEnd:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  case TTypeLIST: {
-    SInt32 elemType;
-    SInt32 size;
-    if (![protocol readListBeginReturningElementType:&elemType size:&size error:error]) {
-      return NO;
-    }
-    int i;
-    for (i = 0; i < size; i++) {
-      if (![TProtocolUtil skipType:elemType onProtocol:protocol error:error]) {
-        return NO;
-      }
-    }
-    if (![protocol readListEnd:error]) {
-      return NO;
-    }
-  }
-  break;
-
-  }
-
-  return YES;
-}
-
-@end
diff --git a/lib/cocoa/src/server/TSocketServer.h b/lib/cocoa/src/server/TSocketServer.h
deleted file mode 100644
index 95b0d3c..0000000
--- a/lib/cocoa/src/server/TSocketServer.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProtocolFactory.h"
-#import "TProcessorFactory.h"
-
-#if !TARGET_OS_IPHONE
-#import <CoreServices/CoreServices.h>
-#else
-#import <CFNetwork/CFNetwork.h>
-#endif
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-extern NSString *const TSocketServerClientConnectionFinished;
-extern NSString *const TSocketServerProcessorKey;
-extern NSString *const TSockerServerTransportKey;
-
-
-@interface TSocketServer : NSObject
-
--(instancetype) initWithPort:(int)port
-             protocolFactory:(id <TProtocolFactory>)protocolFactory
-            processorFactory:(id <TProcessorFactory>)processorFactory;
-
-- (instancetype) initWithPath: (NSString *) path
-              protocolFactory: (id <TProtocolFactory>) protocolFactory
-             processorFactory: (id <TProcessorFactory>) processorFactory;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/server/TSocketServer.m b/lib/cocoa/src/server/TSocketServer.m
deleted file mode 100644
index 09b603c..0000000
--- a/lib/cocoa/src/server/TSocketServer.m
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TSocketServer.h"
-#import "TNSFileHandleTransport.h"
-#import "TProtocol.h"
-#import "TTransportError.h"
-
-#import <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-
-
-NSString *const TSocketServerClientConnectionFinished = @"TSocketServerClientConnectionFinished";
-NSString *const TSocketServerProcessorKey = @"TSocketServerProcessor";
-NSString *const TSockerServerTransportKey = @"TSockerServerTransport";
-
-
-@interface TSocketServer ()
-
-@property(strong, nonatomic) id<TProtocolFactory> inputProtocolFactory;
-@property(strong, nonatomic) id<TProtocolFactory> outputProtocolFactory;
-@property(strong, nonatomic) id<TProcessorFactory> processorFactory;
-@property(strong, nonatomic) NSFileHandle *socketFileHandle;
-@property(strong, nonatomic) dispatch_queue_t processingQueue;
-@property(strong, nonatomic) NSString *domainSocketPath;
-
-@end
-
-
-@implementation TSocketServer
-
--(instancetype) initWithSocket:(CFSocketRef)socket
-             protocolFactory:(id <TProtocolFactory>)protocolFactory
-            processorFactory:(id <TProcessorFactory>)processorFactory;
-{
-  self = [super init];
-
-  _inputProtocolFactory = protocolFactory;
-  _outputProtocolFactory = protocolFactory;
-  _processorFactory = processorFactory;
-
-  dispatch_queue_attr_t processingQueueAttr =
-    dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_BACKGROUND, 0);
-
-  _processingQueue = dispatch_queue_create("TSocketServer.processing", processingQueueAttr);
-
-  // create a socket.
-  int fd = CFSocketGetNative(socket);
-
-  // wrap it in a file handle so we can get messages from it
-  _socketFileHandle = [[NSFileHandle alloc] initWithFileDescriptor:fd
-                                                    closeOnDealloc:YES];
-
-  // throw away our socket
-  CFSocketInvalidate(socket);
-  CFRelease(socket);
-
-  // register for notifications of accepted incoming connections
-  [[NSNotificationCenter defaultCenter] addObserver:self
-                                           selector:@selector(connectionAccepted:)
-                                               name:NSFileHandleConnectionAcceptedNotification
-                                             object:_socketFileHandle];
-
-  // tell socket to listen
-  [_socketFileHandle acceptConnectionInBackgroundAndNotify];
-
-  return self;
-}
-
-- (id) initWithPort: (int) port
-    protocolFactory: (id <TProtocolFactory>) protocolFactory
-   processorFactory: (id <TProcessorFactory>) processorFactory
-{
-  CFSocketRef socket = [[self class] createSocketWithPort:port];
-  if (socket == NULL) {
-    return nil;
-  }
-
-  if (self = [self initWithSocket:socket protocolFactory:protocolFactory processorFactory:processorFactory]) {
-    NSLog(@"TSocketServer: Listening on TCP port %d", port);
-  }
-  return self;
-}
-
-
-+(CFSocketRef) createSocketWithPort:(int)port
-{
-  CFSocketRef socket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL);
-  if (socket) {
-    CFSocketSetSocketFlags(socket, CFSocketGetSocketFlags(socket) & ~kCFSocketCloseOnInvalidate);
-    int fd = CFSocketGetNative(socket);
-    int yes = 1;
-    setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&yes, sizeof(yes));
-
-    struct sockaddr_in addr;
-    memset(&addr, 0, sizeof(addr));
-    addr.sin_len = sizeof(addr);
-    addr.sin_family = AF_INET;
-    addr.sin_port = htons(port);
-    addr.sin_addr.s_addr = htonl(INADDR_ANY);
-    NSData *address = [NSData dataWithBytes:&addr length:sizeof(addr)];
-    if (CFSocketSetAddress(socket, (__bridge CFDataRef)address) != kCFSocketSuccess) {
-      CFSocketInvalidate(socket);
-      CFRelease(socket);
-      NSLog(@"TSocketServer: Could not bind to address");
-      return NULL;
-    }
-
-    return socket;
-  }
-  else {
-    NSLog(@"TSocketServer: No server socket");
-    return NULL;
-  }
-}
-
-- (id) initWithPath: (NSString *) path
-    protocolFactory: (id <TProtocolFactory>) protocolFactory
-   processorFactory: (id <TProcessorFactory>) processorFactory
-{
-  _domainSocketPath = path;
-  CFSocketRef socket = [[self class] createSocketWithPath:path];
-  if (socket == NULL) {
-    return nil;
-  }
-
-  if (self = [self initWithSocket:socket protocolFactory:protocolFactory processorFactory:processorFactory]) {
-    NSLog(@"TSocketServer: Listening on path %@", path);
-  }
-  return self;
-}
-
-+ (CFSocketRef) createSocketWithPath: (NSString *) path
-{
-  CFSocketRef socket = CFSocketCreate(kCFAllocatorDefault, PF_LOCAL, SOCK_STREAM, IPPROTO_IP, 0, NULL, NULL);
-  if (socket) {
-    CFSocketSetSocketFlags(socket,  CFSocketGetSocketFlags(socket) & ~kCFSocketCloseOnInvalidate);
-    int fd = CFSocketGetNative(socket);
-    int yes = 1;
-    setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&yes, sizeof(yes));
-
-    size_t nullTerminatedPathLength = path.length + 1;
-    struct sockaddr_un addr;
-    if (nullTerminatedPathLength> sizeof(addr.sun_path)) {
-      NSLog(@"TSocketServer: Unable to create socket at path %@. Path is too long.", path);
-      return NULL;
-    }
-
-    addr.sun_family = AF_LOCAL;
-    memcpy(addr.sun_path, path.UTF8String, nullTerminatedPathLength);
-    addr.sun_len = SUN_LEN(&addr);
-
-    NSData *address = [NSData dataWithBytes:&addr length:sizeof(addr)];
-    if (CFSocketSetAddress(socket, (__bridge CFDataRef)address) != kCFSocketSuccess) {
-      CFSocketInvalidate(socket);
-      CFRelease(socket);
-      NSLog(@"TSocketServer: Could not bind to address");
-      return NULL;
-    }
-
-    return socket;
-  } else {
-    NSLog(@"TSocketServer: No server socket");
-    return NULL;
-  }
-}
-
--(void) dealloc
-{
-  [[NSNotificationCenter defaultCenter] removeObserver:self];
-
-  if (_domainSocketPath != nil) {
-    unlink(_domainSocketPath.UTF8String);
-  }
-}
-
-
--(void) connectionAccepted:(NSNotification *)notification
-{
-  NSFileHandle *socket = [notification.userInfo objectForKey:NSFileHandleNotificationFileHandleItem];
-
-  // Now that we have a client connected, handle request on queue
-  dispatch_async(_processingQueue, ^{
-
-    [self handleClientConnection:socket];
-
-  });
-
-  // Continue accepting connections
-  [_socketFileHandle acceptConnectionInBackgroundAndNotify];
-}
-
-
--(void) handleClientConnection:(NSFileHandle *)clientSocket
-{
-  @autoreleasepool {
-
-    TNSFileHandleTransport *transport = [[TNSFileHandleTransport alloc] initWithFileHandle:clientSocket];
-    id<TProcessor> processor = [_processorFactory processorForTransport:transport];
-
-    id <TProtocol> inProtocol = [_inputProtocolFactory newProtocolOnTransport:transport];
-    id <TProtocol> outProtocol = [_outputProtocolFactory newProtocolOnTransport:transport];
-
-    NSError *error;
-    if (![processor processOnInputProtocol:inProtocol outputProtocol:outProtocol error:&error]) {
-      // Handle error
-      NSLog(@"Error processing request: %@", error);
-    }
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-
-      [NSNotificationCenter.defaultCenter postNotificationName:TSocketServerClientConnectionFinished
-                                                        object:self
-                                                      userInfo:@{TSocketServerProcessorKey: processor,
-                                                                 TSockerServerTransportKey: transport}];
-    });
-
-  }
-}
-
-@end
diff --git a/lib/cocoa/src/transport/TAsyncTransport.h b/lib/cocoa/src/transport/TAsyncTransport.h
deleted file mode 100644
index bab4fbd..0000000
--- a/lib/cocoa/src/transport/TAsyncTransport.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@protocol TAsyncTransport;
-
-
-@protocol TAsyncTransportFactory <NSObject>
-
--(id<TAsyncTransport>) newTransport;
-
-@end
-
-
-typedef void (^TAsyncCompletionBlock)();
-typedef void (^TAsyncFailureBlock)(NSError * __nonnull);
-
-
-@protocol TAsyncTransport <TTransport>
-
--(void) flushWithCompletion:(TAsyncCompletionBlock)completed failure:(TAsyncFailureBlock)failure;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
\ No newline at end of file
diff --git a/lib/cocoa/src/transport/TFramedTransport.h b/lib/cocoa/src/transport/TFramedTransport.h
deleted file mode 100644
index ea68ac4..0000000
--- a/lib/cocoa/src/transport/TFramedTransport.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TFramedTransport : NSObject <TTransport>
-
--(id) initWithTransport:(id <TTransport>)transport;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/TFramedTransport.m b/lib/cocoa/src/transport/TFramedTransport.m
deleted file mode 100644
index 4db65c4..0000000
--- a/lib/cocoa/src/transport/TFramedTransport.m
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TFramedTransport.h"
-#import "TTransportError.h"
-
-#define HEADER_SIZE 4
-#define INIT_FRAME_SIZE 1024
-
-
-@interface TFramedTransport ()
-
-@property(strong, nonatomic) id<TTransport> transport;
-@property(strong, nonatomic) NSMutableData *writeBuffer;
-@property(strong, nonatomic) NSMutableData *readBuffer;
-@property(assign, nonatomic) NSUInteger readOffset;
-
-@end
-
-
-@implementation TFramedTransport
-
--(id) initWithTransport:(id <TTransport>)aTransport
-{
-  if ((self = [self init])) {
-    _transport = aTransport;
-    _readBuffer = nil;
-    _readOffset = 0;
-    _writeBuffer = [NSMutableData dataWithLength:HEADER_SIZE];
-  }
-  return self;
-}
-
--(BOOL) flush:(NSError **)error
-{
-  int len = (int)[_writeBuffer length];
-  int data_len = len - HEADER_SIZE;
-  if (data_len < 0) {
-    if (error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorUnknown
-                               userInfo:@{}];
-    }
-    return NO;
-  }
-
-  UInt8 i32rd[HEADER_SIZE];
-  i32rd[0] = (UInt8)(0xff & (data_len >> 24));
-  i32rd[1] = (UInt8)(0xff & (data_len >> 16));
-  i32rd[2] = (UInt8)(0xff & (data_len >> 8));
-  i32rd[3] = (UInt8)(0xff & (data_len));
-
-  // should we make a copy of the writeBuffer instead? Better for threaded
-  //  operations!
-  [_writeBuffer replaceBytesInRange:NSMakeRange(0, HEADER_SIZE)
-                          withBytes:i32rd length:HEADER_SIZE];
-
-  if (![_transport write:_writeBuffer.mutableBytes offset:0 length:len error:error]) {
-    return NO;
-  }
-
-  if (![_transport flush:error]) {
-    return NO;
-  }
-
-  _writeBuffer.length = HEADER_SIZE;
-
-  return YES;
-}
-
--(BOOL) write:(const UInt8 *)data offset:(UInt32)offset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  [_writeBuffer appendBytes:data+offset length:length];
-
-  return YES;
-}
-
--(BOOL) readAll:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = [self readAvail:outBuffer offset:outBufferOffset maxLength:length error:error];
-  if (got != length) {
-
-    // Report underflow only if readAvail didn't report error already
-    if (error && !*error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorEndOfFile
-                               userInfo:nil];
-    }
-
-    return NO;
-  }
-
-  return YES;
-}
-
--(UInt32) readAvail:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset maxLength:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = 0;
-  while (got < length) {
-
-    NSUInteger avail = _readBuffer.length - _readOffset;
-    if (avail == 0) {
-      if (![self readFrame:error]) {
-        return 0;
-      }
-      avail = _readBuffer.length;
-    }
-
-    NSRange range;
-    range.location = _readOffset;
-    range.length = MIN(length - got, avail);
-
-    [_readBuffer getBytes:outBuffer+outBufferOffset+got range:range];
-    _readOffset += range.length;
-    got += range.length;
-  }
-
-  return got;
-}
-
--(BOOL) readFrame:(NSError **)error
-{
-  UInt8 i32rd[HEADER_SIZE];
-  if (![_transport readAll:i32rd offset:0 length:HEADER_SIZE error:error]) {
-    return NO;
-  }
-
-  SInt32 size =
-    ((i32rd[0] & 0xff) << 24) |
-    ((i32rd[1] & 0xff) << 16) |
-    ((i32rd[2] & 0xff) <<  8) |
-    ((i32rd[3] & 0xff));
-
-  if (_readBuffer == nil) {
-
-    _readBuffer = [NSMutableData dataWithLength:size];
-
-  }
-  else {
-
-    SInt32 len = (SInt32)_readBuffer.length;
-    if (len >= size) {
-
-      _readBuffer.length = size;
-
-    }
-    else {
-
-      // increase length of data buffer
-      [_readBuffer increaseLengthBy:size-len];
-
-    }
-
-  }
-
-  // copy into internal memory buffer
-  if (![_transport readAll:_readBuffer.mutableBytes offset:0 length:size error:error]) {
-    return NO;
-  }
-
-  return YES;
-}
-
-@end
diff --git a/lib/cocoa/src/transport/THTTPSessionTransport.h b/lib/cocoa/src/transport/THTTPSessionTransport.h
deleted file mode 100644
index 003499b..0000000
--- a/lib/cocoa/src/transport/THTTPSessionTransport.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TAsyncTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-typedef NSError *__nullable (^THTTPSessionTransportResponseValidateBlock) (NSHTTPURLResponse *response, NSData *responseData);
-
-
-@interface THTTPSessionTransportFactory : NSObject<TAsyncTransportFactory>
-
-@property (strong, nonatomic) THTTPSessionTransportResponseValidateBlock responseValidate;
-
-+(void) setupDefaultsForSessionConfiguration:(NSURLSessionConfiguration *)config
-                            withProtocolName:(NSString *)protocolName;
-
--(id) initWithSession:(NSURLSession *)session
-                  URL:(NSURL *)aURL;
-
-@end
-
-
-@interface THTTPSessionTransport : NSObject <TAsyncTransport>
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/THTTPSessionTransport.m b/lib/cocoa/src/transport/THTTPSessionTransport.m
deleted file mode 100644
index c10b7fc..0000000
--- a/lib/cocoa/src/transport/THTTPSessionTransport.m
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "THTTPSessionTransport.h"
-#import "TTransportError.h"
-
-
-@interface THTTPSessionTransportFactory ()
-
-@property (strong, nonatomic) NSURLSession *session;
-@property (strong, nonatomic) NSURL *url;
-
-@end
-
-
-@interface THTTPSessionTransport ()
-
-@property (strong, nonatomic) THTTPSessionTransportFactory *factory;
-@property (strong, nonatomic) NSMutableData *requestData;
-@property (strong, nonatomic) NSData *responseData;
-@property (assign, nonatomic) NSUInteger responseDataOffset;
-
--(instancetype) initWithFactory:(THTTPSessionTransportFactory *)factory;
-
-@end
-
-
-@implementation THTTPSessionTransportFactory
-
-+(void) setupDefaultsForSessionConfiguration:(NSURLSessionConfiguration *)config withProtocolName:(NSString *)protocolName
-{
-  NSString *thriftContentType = @"application/x-thrift";
-  if (protocolName.length) {
-    thriftContentType = [thriftContentType stringByAppendingFormat:@"; p=%@", protocolName];
-  }
-
-  config.requestCachePolicy = NSURLRequestReloadIgnoringCacheData;
-  config.HTTPShouldUsePipelining = YES;
-  config.HTTPShouldSetCookies = NO;
-  config.URLCache = nil;
-  config.HTTPAdditionalHeaders = @{@"Content-Type":thriftContentType,
-                                   @"Accept":thriftContentType,
-                                   @"User-Agent":@"Thrift/Cocoa (Session)"};
-}
-
-
--(id) initWithSession:(NSURLSession *)session URL:(NSURL *)url
-{
-  self = [super init];
-  if (self) {
-    _session = session;
-    _url = url;
-  }
-
-  return self;
-}
-
--(id<TAsyncTransport>) newTransport
-{
-  return [[THTTPSessionTransport alloc] initWithFactory:self];
-}
-
--(NSURLSessionDataTask *) taskWithRequest:(NSURLRequest *)request
-                        completionHandler:(void (^)(NSData *data, NSURLResponse *response, NSError *error))completionHandler
-                                    error:(NSError *__autoreleasing *)error
-{
-  NSURLSessionDataTask *newTask = [_session dataTaskWithRequest:request completionHandler:completionHandler];
-  if (!newTask) {
-    if (error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorUnknown
-                               userInfo:@{NSLocalizedDescriptionKey:@"Failed to create session data task"}];
-    }
-    return nil;
-  }
-
-  return newTask;
-}
-
--(NSError *) validateResponse:(NSHTTPURLResponse *)response data:(NSData *)data
-{
-  if (_responseValidate) {
-    return _responseValidate(response, data);
-  }
-  return nil;
-}
-
-@end
-
-
-
-@implementation THTTPSessionTransport
-
--(instancetype) initWithFactory:(THTTPSessionTransportFactory *)factory
-{
-  self = [super init];
-  if (self) {
-    _factory = factory;
-  }
-  return self;
-}
-
--(BOOL) readAll:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = [self readAvail:outBuffer offset:outBufferOffset maxLength:length error:error];
-  if (got != length) {
-
-    // Report underflow only if readAvail didn't report error already
-    if (error && !*error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorEndOfFile
-                               userInfo:nil];
-    }
-
-    return NO;
-  }
-
-  return YES;
-}
-
--(UInt32) readAvail:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset maxLength:(UInt32)maxLength error:(NSError *__autoreleasing *)error
-{
-  NSUInteger avail = _responseData.length - _responseDataOffset;
-
-  NSRange range;
-  range.location = _responseDataOffset;
-  range.length = MIN(maxLength, avail);
-
-  [_responseData getBytes:outBuffer+outBufferOffset range:range];
-  _responseDataOffset += range.length;
-
-  return (UInt32)range.length;
-}
-
--(BOOL) write:(const UInt8 *)data offset:(UInt32)offset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  if (!_requestData) {
-    _requestData = [NSMutableData dataWithCapacity:256];
-  }
-
-  [_requestData appendBytes:data+offset length:length];
-
-  return YES;
-}
-
--(void) flushWithCompletion:(TAsyncCompletionBlock)completed failure:(TAsyncFailureBlock)failure
-{
-  NSError *error;
-
-  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:_factory.url];
-  request.HTTPMethod = @"POST";
-  request.HTTPBody = _requestData;
-
-  _requestData = nil;
-
-  NSURLSessionDataTask *task = [_factory taskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
-
-    // Check response type
-    if (!error && ![response isKindOfClass:NSHTTPURLResponse.class]) {
-
-      error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorUnknown
-                               userInfo:@{TTransportErrorHttpErrorKey: @(THttpTransportErrorInvalidResponse)}];
-
-    }
-
-    // Check status code
-    NSHTTPURLResponse *httpResponse = (id)response;
-    if (!error && httpResponse.statusCode != 200) {
-
-      THttpTransportError code;
-      if (httpResponse.statusCode == 401) {
-        code = THttpTransportErrorAuthentication;
-      }
-      else {
-        code = THttpTransportErrorInvalidStatus;
-      }
-
-      error = [NSError errorWithDomain:TTransportErrorDomain
-                                  code:TTransportErrorUnknown
-                              userInfo:@{TTransportErrorHttpErrorKey: @(code),
-                                         @"statusCode":@(httpResponse.statusCode)}];
-    }
-
-    // Allow factory to check
-    if (!error) {
-      error = [_factory validateResponse:httpResponse data:data];
-    }
-
-    _responseDataOffset = 0;
-
-    if (error) {
-
-      _responseData = nil;
-
-      failure(error);
-
-    }
-    else {
-
-      if (data == nil) {
-        data = [NSData data];
-      }
-
-      _responseData = data;
-
-      completed(self);
-    }
-
-  } error:&error];
-
-  if (!task) {
-    failure(error);
-    return;
-  }
-
-  [task resume];
-}
-
--(BOOL) flush:(NSError *__autoreleasing *)error
-{
-  dispatch_semaphore_t completed = dispatch_semaphore_create(0);
-
-  __block BOOL result;
-  __block NSError *internalError;
-
-  [self flushWithCompletion:^(id < TAsyncTransport > transport) {
-
-    result = YES;
-
-    dispatch_semaphore_signal(completed);
-
-  } failure:^(NSError *error) {
-
-    internalError = error;
-
-    result = NO;
-
-    dispatch_semaphore_signal(completed);
-
-  }];
-
-  dispatch_semaphore_wait(completed, DISPATCH_TIME_FOREVER);
-
-  if (error) {
-    *error = internalError;
-  }
-
-  return result;
-}
-
-@end
diff --git a/lib/cocoa/src/transport/THTTPTransport.h b/lib/cocoa/src/transport/THTTPTransport.h
deleted file mode 100644
index 3c35daf..0000000
--- a/lib/cocoa/src/transport/THTTPTransport.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface THTTPTransport : NSObject <TTransport>
-
--(id) initWithURL:(NSURL *)aURL;
-
--(id) initWithURL:(NSURL *)aURL
-        userAgent:(nullable NSString *)userAgent
-          timeout:(int)timeout;
-
--(void) setURL:(NSURL *)aURL;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/THTTPTransport.m b/lib/cocoa/src/transport/THTTPTransport.m
deleted file mode 100644
index e4046c6..0000000
--- a/lib/cocoa/src/transport/THTTPTransport.m
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "THTTPTransport.h"
-#import "TTransportError.h"
-
-
-@interface THTTPTransport ()
-
-@property (strong, nonatomic) NSURL *url;
-@property (strong, nonatomic) NSMutableURLRequest *request;
-@property (strong, nonatomic) NSMutableData *requestData;
-@property (strong, nonatomic) NSData *responseData;
-@property (assign, nonatomic) NSUInteger responseDataOffset;
-@property (strong, nonatomic) NSString *userAgent;
-@property (assign, nonatomic) NSTimeInterval timeout;
-
-@end
-
-
-@implementation THTTPTransport
-
--(void) setupRequest
-{
-  // set up our request object that we'll use for each request
-  _request = [[NSMutableURLRequest alloc] initWithURL:_url];
-  [_request setHTTPMethod:@"POST"];
-  [_request setValue:@"application/x-thrift" forHTTPHeaderField:@"Content-Type"];
-  [_request setValue:@"application/x-thrift" forHTTPHeaderField:@"Accept"];
-
-  NSString *userAgent = _userAgent;
-  if (!userAgent) {
-    userAgent = @"Thrift/Cocoa";
-  }
-  [_request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
-
-  [_request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
-  if (_timeout) {
-    [_request setTimeoutInterval:_timeout];
-  }
-}
-
-
--(id) initWithURL:(NSURL *)aURL
-{
-  return [self initWithURL:aURL
-                 userAgent:nil
-                   timeout:0];
-}
-
-
--(id) initWithURL:(NSURL *)aURL
-        userAgent:(NSString *)aUserAgent
-          timeout:(int)aTimeout
-{
-  self = [super init];
-  if (!self) {
-    return nil;
-  }
-
-  _timeout = aTimeout;
-  _userAgent = aUserAgent;
-  _url = aURL;
-
-  [self setupRequest];
-
-  // create our request data buffer
-  _requestData = [[NSMutableData alloc] initWithCapacity:1024];
-
-  return self;
-}
-
--(void) setURL:(NSURL *)aURL
-{
-  _url = aURL;
-
-  [self setupRequest];
-}
-
--(BOOL) readAll:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = [self readAvail:outBuffer offset:outBufferOffset maxLength:length error:error];
-  if (got != length) {
-
-    // Report underflow only if readAvail didn't report error already
-    if (error && !*error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorEndOfFile
-                               userInfo:nil];
-    }
-
-    return NO;
-  }
-
-  return YES;
-}
-
--(UInt32) readAvail:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset maxLength:(UInt32)maxLength error:(NSError *__autoreleasing *)error
-{
-  NSUInteger avail = _responseData.length - _responseDataOffset;
-
-  NSRange range;
-  range.location = _responseDataOffset;
-  range.length = MIN(maxLength, avail);
-
-  [_responseData getBytes:outBuffer+outBufferOffset range:range];
-  _responseDataOffset += range.length;
-
-  return (UInt32)range.length;
-}
-
--(BOOL) write:(const UInt8 *)data offset:(UInt32)offset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  [_requestData appendBytes:data+offset length:length];
-
-  return YES;
-}
-
--(BOOL) flush:(NSError *__autoreleasing *)error
-{
-  [_request setHTTPBody:_requestData];
-
-  _responseDataOffset = 0;
-
-  // make the HTTP request
-  NSURLResponse *response;
-  _responseData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:error];
-  if (!_responseData) {
-    return NO;
-  }
-
-  [_requestData setLength:0];
-
-  if (![response isKindOfClass:NSHTTPURLResponse.class]) {
-    if (error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorUnknown
-                               userInfo:@{TTransportErrorHttpErrorKey: @(THttpTransportErrorInvalidResponse)}];
-    }
-    return NO;
-  }
-
-  NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
-  if ([httpResponse statusCode] != 200) {
-    if (error) {
-
-      THttpTransportError code;
-      if (httpResponse.statusCode == 401) {
-        code = THttpTransportErrorAuthentication;
-      }
-      else {
-        code = THttpTransportErrorInvalidStatus;
-      }
-
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorUnknown
-                               userInfo:@{TTransportErrorHttpErrorKey: @(code),
-                                          @"statusCode":@(httpResponse.statusCode)}];
-    }
-    return NO;
-  }
-
-  return YES;
-}
-
-@end
diff --git a/lib/cocoa/src/transport/TMemoryBuffer.h b/lib/cocoa/src/transport/TMemoryBuffer.h
deleted file mode 100644
index 6249d32..0000000
--- a/lib/cocoa/src/transport/TMemoryBuffer.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TMemoryBuffer : NSObject <TTransport>
-
--(NSData *) buffer;
-
--(id) initWithData:(NSData *)data;
-
--(id) initWithDataNoCopy:(NSMutableData *)data;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/TMemoryBuffer.m b/lib/cocoa/src/transport/TMemoryBuffer.m
deleted file mode 100644
index ec19cc8..0000000
--- a/lib/cocoa/src/transport/TMemoryBuffer.m
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TMemoryBuffer.h"
-#import "TTransportError.h"
-
-
-#define GARBAGE_BUFFER_SIZE 4096 // 4KiB
-
-
-@interface TMemoryBuffer ()
-
-@property(strong, nonatomic) NSMutableData *buffer;
-@property(assign, nonatomic) UInt32 bufferOffset;
-
-@end
-
-
-@implementation TMemoryBuffer
-
--(id) init
-{
-  if ((self = [super init])) {
-    _buffer = [NSMutableData new];
-    _bufferOffset = 0;
-  }
-  return self;
-}
-
--(id) initWithData:(NSData *)data
-{
-  if (self = [super init]) {
-    _buffer = [data mutableCopy];
-    _bufferOffset = 0;
-  }
-  return self;
-}
-
--(id) initWithDataNoCopy:(NSMutableData *)data
-{
-  if (self = [super init]) {
-    _buffer = data;
-    _bufferOffset = 0;
-  }
-  return self;
-}
-
--(BOOL) readAll:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = [self readAvail:outBuffer offset:outBufferOffset maxLength:length error:error];
-  if (got != length) {
-
-    // Report underflow only if readAvail didn't report error already
-    if (error && !*error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorEndOfFile
-                               userInfo:nil];
-    }
-
-    return NO;
-  }
-
-  return YES;
-}
-
--(UInt32) readAvail:(UInt8 *)outBuffer offset:(UInt32)outBufferOffset maxLength:(UInt32)maxLength error:(NSError *__autoreleasing *)error
-{
-  UInt32 avail = (UInt32)_buffer.length - _bufferOffset;
-  if (avail == 0) {
-    return 0;
-  }
-
-  NSRange range;
-  range.location = _bufferOffset;
-  range.length = MIN(maxLength, avail);
-
-  [_buffer getBytes:outBuffer + outBufferOffset range:range];
-  _bufferOffset += range.length;
-
-  if (_bufferOffset >= GARBAGE_BUFFER_SIZE) {
-    [_buffer replaceBytesInRange:NSMakeRange(0, _bufferOffset) withBytes:NULL length:0];
-    _bufferOffset = 0;
-  }
-
-  return (UInt32)range.length;
-}
-
--(BOOL) write:(const UInt8 *)inBuffer offset:(UInt32)inBufferOffset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  [_buffer appendBytes:inBuffer + inBufferOffset length:length];
-
-  return YES;
-}
-
--(NSData *) buffer
-{
-  return _buffer;
-}
-
--(BOOL) flush:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-@end
diff --git a/lib/cocoa/src/transport/TNSFileHandleTransport.h b/lib/cocoa/src/transport/TNSFileHandleTransport.h
deleted file mode 100644
index db6edf3..0000000
--- a/lib/cocoa/src/transport/TNSFileHandleTransport.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-#import <Foundation/Foundation.h>
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TNSFileHandleTransport : NSObject <TTransport>
-
--(id) initWithFileHandle:(NSFileHandle *)fileHandle;
-
--(id) initWithInputFileHandle:(NSFileHandle *)inputFileHandle
-             outputFileHandle:(NSFileHandle *)outputFileHandle;
-
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/TNSFileHandleTransport.m b/lib/cocoa/src/transport/TNSFileHandleTransport.m
deleted file mode 100644
index c907f87..0000000
--- a/lib/cocoa/src/transport/TNSFileHandleTransport.m
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-#import "TNSFileHandleTransport.h"
-#import "TTransportError.h"
-
-
-@interface TNSFileHandleTransport ()
-
-@property(strong, nonatomic) NSFileHandle *inputFileHandle;
-@property(strong, nonatomic) NSFileHandle *outputFileHandle;
-
-@end
-
-
-@implementation TNSFileHandleTransport
-
--(id) initWithFileHandle:(NSFileHandle *)fileHandle
-{
-  return [self initWithInputFileHandle:fileHandle
-                      outputFileHandle:fileHandle];
-}
-
-
--(id) initWithInputFileHandle:(NSFileHandle *)aInputFileHandle
-             outputFileHandle:(NSFileHandle *)aOutputFileHandle
-{
-  self = [super init];
-  if (self) {
-    _inputFileHandle = aInputFileHandle;
-    _outputFileHandle = aOutputFileHandle;
-  }
-  return self;
-}
-
-
--(BOOL) readAll:(UInt8 *)buf offset:(UInt32)off length:(UInt32)len error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = 0;
-  while (got < len) {
-
-    NSData *d = [_inputFileHandle readDataOfLength:len-got];
-    if (d.length == 0) {
-      if (error) {
-        *error = [NSError errorWithDomain:TTransportErrorDomain
-                                     code:TTransportErrorEndOfFile
-                                 userInfo:nil];
-      }
-      return NO;
-    }
-
-    [d getBytes:buf+got length:d.length];
-    got += d.length;
-  }
-  return YES;
-}
-
-
--(UInt32) readAvail:(UInt8 *)buf offset:(UInt32)off maxLength:(UInt32)len error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = 0;
-  while (got < len) {
-
-    NSData *d = [_inputFileHandle readDataOfLength:len-got];
-    if (d.length == 0) {
-      break;
-    }
-
-    [d getBytes:buf+got length:d.length];
-    got += d.length;
-  }
-  return got;
-}
-
-
--(BOOL) write:(const UInt8 *)data offset:(UInt32)offset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  void *pos = (void *)data + offset;
-
-  @try {
-    [_outputFileHandle writeData:[NSData dataWithBytesNoCopy:pos length:length freeWhenDone:NO]];
-  }
-  @catch (NSException *e) {
-    if (error) {
-      *error = [NSError errorWithDomain:TTransportErrorDomain
-                                   code:TTransportErrorNotOpen
-                               userInfo:@{}];
-    }
-    return NO;
-  }
-
-  return YES;
-}
-
-
--(BOOL) flush:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
-@end
diff --git a/lib/cocoa/src/transport/TNSStreamTransport.h b/lib/cocoa/src/transport/TNSStreamTransport.h
deleted file mode 100644
index 54c4884..0000000
--- a/lib/cocoa/src/transport/TNSStreamTransport.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TNSStreamTransport : NSObject <TTransport>
-
-@property (strong, nonatomic) NSInputStream *input;
-@property (strong, nonatomic) NSOutputStream *output;
-
--(id) initWithInputStream:(nullable NSInputStream *)input
-             outputStream:(nullable NSOutputStream *)output;
-
--(id) initWithInputStream:(NSInputStream *)input;
-
--(id) initWithOutputStream:(NSOutputStream *)output;
-
--(void) close;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/TNSStreamTransport.m b/lib/cocoa/src/transport/TNSStreamTransport.m
deleted file mode 100644
index 18c41d3..0000000
--- a/lib/cocoa/src/transport/TNSStreamTransport.m
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TNSStreamTransport.h"
-#import "TTransportError.h"
-
-
-@interface TNSStreamTransport ()
-@end
-
-
-@implementation TNSStreamTransport
-
--(id) initWithInputStream:(NSInputStream *)input
-             outputStream:(NSOutputStream *)output
-{
-  self = [super init];
-  if (self) {
-    _input = input;
-    _output = output;
-  }
-  return self;
-}
-
--(id) initWithInputStream:(NSInputStream *)input
-{
-  return [self initWithInputStream:input outputStream:nil];
-}
-
--(id) initWithOutputStream:(NSOutputStream *)output
-{
-  return [self initWithInputStream:nil outputStream:output];
-}
-
--(void) dealloc
-{
-  [self close];
-}
-
--(BOOL) readAll:(UInt8 *)buf offset:(UInt32)off length:(UInt32)len error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = 0;
-  while (got < len) {
-
-    UInt32 read = (UInt32)[_input read:buf+off+got maxLength:len-got];
-    if (read <= 0) {
-      if (error) {
-        *error = [NSError errorWithDomain:TTransportErrorDomain
-                                     code:TTransportErrorNotOpen
-                                 userInfo:@{}];
-      }
-      return NO;
-    }
-
-    got += read;
-  }
-
-  return YES;
-}
-
-
--(UInt32) readAvail:(UInt8 *)buf offset:(UInt32)off maxLength:(UInt32)len error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = 0;
-  while (got < len) {
-
-    UInt32 read = (UInt32)[_input read:buf+off+got maxLength:len-got];
-    if (read <= 0) {
-      break;
-    }
-
-    got += read;
-  }
-
-  return got;
-}
-
-
--(BOOL) write:(const UInt8 *)data offset:(UInt32)offset length:(UInt32)length error:(NSError *__autoreleasing *)error
-{
-  UInt32 got = 0;
-  NSInteger total = 0;
-  while (got < length) {
-
-    total = [_output write:data+offset+got maxLength:length-got];
-    if (total == -1) {
-      if (error) {
-        *error = [NSError errorWithDomain:TTransportErrorDomain
-                                     code:TTransportErrorNotOpen
-                                 userInfo:@{}];
-      }
-      return NO;
-    }
-    else if (total == 0) {
-      if (error) {
-        *error = [NSError errorWithDomain:TTransportErrorDomain
-                                     code:TTransportErrorEndOfFile
-                                 userInfo:@{}];
-      }
-      return NO;
-    }
-
-    got += total;
-  }
-
-  return YES;
-}
-
--(BOOL) flush:(NSError *__autoreleasing *)error
-{
-  return YES;
-}
-
--(void) close
-{
-  NSInputStream *input = self.input;
-  if (input) {
-    // Close and reset inputstream
-    CFReadStreamSetProperty((__bridge CFReadStreamRef)(input), kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
-    [input setDelegate:nil];
-    [input close];
-    [input removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
-    input = nil;
-  }
-
-  NSOutputStream *output = self.output;
-  if (output) {
-    // Close and reset outputstream
-    CFWriteStreamSetProperty((__bridge CFWriteStreamRef)(output), kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
-    [output setDelegate:nil];
-    [output close];
-    [output removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
-    output = nil;
-  }
-}
-
-@end
diff --git a/lib/cocoa/src/transport/TSSLSocketTransport.h b/lib/cocoa/src/transport/TSSLSocketTransport.h
deleted file mode 100644
index b606c4a..0000000
--- a/lib/cocoa/src/transport/TSSLSocketTransport.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TNSStreamTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TSSLSocketTransport : TNSStreamTransport <NSStreamDelegate>
-
--(id) initWithHostname:(NSString *)hostname
-                  port:(int)port
-                 error:(NSError **)error;
-
--(BOOL) isOpen;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/TSSLSocketTransport.m b/lib/cocoa/src/transport/TSSLSocketTransport.m
deleted file mode 100644
index 1b1214f..0000000
--- a/lib/cocoa/src/transport/TSSLSocketTransport.m
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#import <Foundation/Foundation.h>
-#import <CoreFoundation/CoreFoundation.h>
-#import "TSSLSocketTransport.h"
-#import "TSSLSocketTransportError.h"
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-#if !TARGET_OS_IPHONE
-#import <CoreServices/CoreServices.h>
-#else
-#import <CFNetwork/CFNetwork.h>
-#endif
-
-@interface TSSLSocketTransport ()
-
-@property(strong, nonatomic) NSString *sslHostname;
-@property(assign, nonatomic) int sd;
-
-@end
-
-
-@implementation TSSLSocketTransport
-
--(id) initWithHostname:(NSString *)hostname
-                  port:(int)port
-                 error:(NSError **)error
-{
-  _sslHostname = hostname;
-  CFReadStreamRef readStream = NULL;
-  CFWriteStreamRef writeStream = NULL;
-
-
-  /* create a socket structure */
-  struct sockaddr_in pin;
-  struct hostent *hp = NULL;
-  for (int i = 0; i < 10; i++) {
-
-
-
-    if ((hp = gethostbyname([hostname UTF8String])) == NULL) {
-      NSLog(@"failed to resolve hostname %@", hostname);
-      herror("resolv");
-      if (i == 9) {
-        if (error) {
-          *error = [NSError errorWithDomain:TSSLSocketTransportErrorDomain
-                                       code:TSSLSocketTransportErrorHostanameResolution
-                                   userInfo:nil];
-        }
-        return nil;
-      }
-      [NSThread sleepForTimeInterval:0.2];
-    }
-    else {
-      break;
-    }
-  }
-
-  memset(&pin, 0, sizeof(pin));
-  pin.sin_family = AF_INET;
-  memcpy(&pin.sin_addr, hp->h_addr, sizeof(struct in_addr));
-  pin.sin_port = htons(port);
-
-  /* create the socket */
-  if ((_sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
-    NSLog(@"failed to create socket for host %@:%d", hostname, port);
-    if (error) {
-      *error = [NSError errorWithDomain:TSSLSocketTransportErrorDomain
-                                   code:TSSLSocketTransportErrorSocketCreate
-                               userInfo:nil];
-    }
-    return nil;
-  }
-
-  /* open a connection */
-  if (connect(_sd, (struct sockaddr *)&pin, sizeof(pin)) == -1) {
-    NSLog(@"failed to create conenct to host %@:%d", hostname, port);
-    if (error) {
-      *error = [NSError errorWithDomain:TSSLSocketTransportErrorDomain
-                                   code:TSSLSocketTransportErrorConnect
-                               userInfo:nil];
-    }
-    return nil;
-  }
-  CFStreamCreatePairWithSocket(kCFAllocatorDefault, _sd, &readStream, &writeStream);
-
-  CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
-  CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
-
-  NSInputStream *inputStream;
-  NSOutputStream *outputStream;
-
-  if (readStream && writeStream) {
-
-    CFReadStreamSetProperty(readStream,
-                            kCFStreamPropertySocketSecurityLevel,
-                            kCFStreamSocketSecurityLevelTLSv1);
-
-    NSDictionary *settings = @{(__bridge NSString *)kCFStreamSSLValidatesCertificateChain: @YES};
-
-    CFReadStreamSetProperty((CFReadStreamRef)readStream,
-                            kCFStreamPropertySSLSettings,
-                            (CFTypeRef)settings);
-
-    CFWriteStreamSetProperty((CFWriteStreamRef)writeStream,
-                             kCFStreamPropertySSLSettings,
-                             (CFTypeRef)settings);
-
-    inputStream = (__bridge NSInputStream *)readStream;
-    [inputStream setDelegate:self];
-    [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
-    [inputStream open];
-
-    outputStream = (__bridge NSOutputStream *)writeStream;
-    [outputStream setDelegate:self];
-    [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
-    [outputStream open];
-
-    CFRelease(readStream);
-    CFRelease(writeStream);
-  }
-
-  self = [super initWithInputStream:inputStream outputStream:outputStream];
-
-  return self;
-}
-
--(void) dealloc
-{
-  [self close];
-}
-
-#pragma mark -
-#pragma mark NSStreamDelegate
-
--(void) stream:(NSStream *)aStream
-   handleEvent:(NSStreamEvent)eventCode
-{
-  switch (eventCode) {
-  case NSStreamEventNone:
-    break;
-
-  case NSStreamEventHasBytesAvailable:
-    break;
-
-  case NSStreamEventOpenCompleted:
-    break;
-
-  case NSStreamEventHasSpaceAvailable: {
-
-    BOOL proceed = NO;
-    SecTrustResultType trustResult = kSecTrustResultInvalid;
-    CFMutableArrayRef newPolicies = NULL;
-
-    do {
-
-      SecTrustRef trust = (__bridge SecTrustRef)[aStream propertyForKey:(NSString *)kCFStreamPropertySSLPeerTrust];
-
-      // Add new policy to current list of policies
-      SecPolicyRef policy = SecPolicyCreateSSL(NO, (__bridge CFStringRef)(_sslHostname));
-      if (!policy) {
-        break;
-      }
-
-      CFArrayRef policies;
-      if (SecTrustCopyPolicies(trust, &policies) != errSecSuccess) {
-        CFRelease(policy);
-        break;
-      }
-
-      newPolicies = CFArrayCreateMutableCopy(NULL, 0, policies);
-      CFArrayAppendValue(newPolicies, policy);
-
-      CFRelease(policies);
-      CFRelease(policy);
-
-      // Update trust policies
-      if (SecTrustSetPolicies(trust, newPolicies) != errSecSuccess) {
-        break;
-      }
-
-      // Evaluate the trust chain
-      if (SecTrustEvaluate(trust, &trustResult) != errSecSuccess) {
-        break;
-      }
-
-      switch (trustResult) {
-      case kSecTrustResultProceed:
-        // NSLog(@"Trusted by USER");
-        proceed = YES;
-        break;
-
-      case kSecTrustResultUnspecified:
-        // NSLog(@"Trusted by OS");
-        proceed = YES;
-        break;
-
-      case kSecTrustResultRecoverableTrustFailure:
-        proceed = recoverFromTrustFailure(trust, trustResult);
-        break;
-
-      case kSecTrustResultDeny:
-        // NSLog(@"Deny");
-        break;
-
-      case kSecTrustResultFatalTrustFailure:
-        // NSLog(@"FatalTrustFailure");
-        break;
-
-      case kSecTrustResultOtherError:
-        // NSLog(@"OtherError");
-        break;
-
-      case kSecTrustResultInvalid:
-        // NSLog(@"Invalid");
-        break;
-
-      default:
-        // NSLog(@"Default");
-        break;
-      }
-
-    }
-    while (NO);
-
-    if (!proceed) {
-      NSLog(@"TSSLSocketTransport: Cannot trust certificate. Result: %u", trustResult);
-      [aStream close];
-    }
-
-    if (newPolicies) {
-      CFRelease(newPolicies);
-    }
-
-  }
-  break;
-
-  case NSStreamEventErrorOccurred: {
-    NSLog(@"TSSLSocketTransport: Error occurred opening stream: %@", [aStream streamError]);
-    break;
-  }
-
-  case NSStreamEventEndEncountered:
-    break;
-  }
-}
-
-BOOL recoverFromTrustFailure(SecTrustRef myTrust, SecTrustResultType lastTrustResult)
-{
-  CFAbsoluteTime trustTime = SecTrustGetVerifyTime(myTrust);
-  CFAbsoluteTime currentTime = CFAbsoluteTimeGetCurrent();
-
-  CFAbsoluteTime timeIncrement = 31536000;
-  CFAbsoluteTime newTime = currentTime - timeIncrement;
-
-  if (trustTime - newTime) {
-
-    CFDateRef newDate = CFDateCreate(NULL, newTime);
-    SecTrustSetVerifyDate(myTrust, newDate);
-    CFRelease(newDate);
-
-    if (SecTrustEvaluate(myTrust, &lastTrustResult) != errSecSuccess) {
-      return NO;
-    }
-
-  }
-
-  if (lastTrustResult == kSecTrustResultProceed || lastTrustResult == kSecTrustResultUnspecified) {
-    return YES;
-  }
-
-  NSLog(@"TSSLSocketTransport: Unable to recover certificate trust failure");
-  return YES;
-}
-
--(BOOL) isOpen
-{
-  if (_sd > 0) {
-    return TRUE;
-  }
-  else {
-    return FALSE;
-  }
-}
-
-@end
diff --git a/lib/cocoa/src/transport/TSSLSocketTransportError.h b/lib/cocoa/src/transport/TSSLSocketTransportError.h
deleted file mode 100644
index e17f39e..0000000
--- a/lib/cocoa/src/transport/TSSLSocketTransportError.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TTransportError.h"
-
-
-extern NSString *TSSLSocketTransportErrorDomain;
-
-
-typedef NS_ENUM (int, TSSLSocketTransportError) {
-  TSSLSocketTransportErrorHostanameResolution  = -10000,
-  TSSLSocketTransportErrorSocketCreate         = -10001,
-  TSSLSocketTransportErrorConnect              = -10002,
-};
diff --git a/lib/cocoa/src/transport/TSSLSocketTransportError.m b/lib/cocoa/src/transport/TSSLSocketTransportError.m
deleted file mode 100644
index bcf941c..0000000
--- a/lib/cocoa/src/transport/TSSLSocketTransportError.m
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TSSLSocketTransportError.h"
-
-
-NSString *TSSLSocketTransportErrorDomain = @"TSSLSocketTransportErrorDomain";
diff --git a/lib/cocoa/src/transport/TSocketTransport.h b/lib/cocoa/src/transport/TSocketTransport.h
deleted file mode 100644
index a7b91a2..0000000
--- a/lib/cocoa/src/transport/TSocketTransport.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TNSStreamTransport.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@interface TSocketTransport : TNSStreamTransport
-
--(id) initWithHostname:(NSString *)hostname
-                  port:(int)port;
-
--(id) initWithPath:(NSString *)path;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/TSocketTransport.m b/lib/cocoa/src/transport/TSocketTransport.m
deleted file mode 100644
index 9c58abb..0000000
--- a/lib/cocoa/src/transport/TSocketTransport.m
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#import "TSocketTransport.h"
-
-#if !TARGET_OS_IPHONE
-#import <CoreServices/CoreServices.h>
-#else
-#import <CFNetwork/CFNetwork.h>
-#endif
-
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-
-@interface TSocketTransport () <NSStreamDelegate>
-@end
-
-
-@implementation TSocketTransport
-
-- (id) initWithReadStream: (CFReadStreamRef) readStream writeStream: (CFWriteStreamRef) writeStream
-{
-  NSInputStream *inputStream = nil;
-  NSOutputStream *outputStream = nil;
-
-  if (readStream && writeStream) {
-
-    CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
-    CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
-
-    inputStream = (__bridge NSInputStream *)readStream;
-    [inputStream setDelegate:self];
-    [inputStream scheduleInRunLoop:NSRunLoop.currentRunLoop forMode:NSDefaultRunLoopMode];
-    [inputStream open];
-
-    outputStream = (__bridge NSOutputStream *)writeStream;
-    [outputStream setDelegate:self];
-    [outputStream scheduleInRunLoop:NSRunLoop.currentRunLoop forMode:NSDefaultRunLoopMode];
-    [outputStream open];
-  }
-  else {
-
-    if (readStream) {
-      CFRelease(readStream);
-    }
-
-    if (writeStream) {
-      CFRelease(writeStream);
-    }
-
-    return nil;
-  }
-
-  return [super initWithInputStream:inputStream outputStream:outputStream];
-}
-
-- (id) initWithHostname: (NSString *) hostname
-                   port: (int) port
-{
-  CFReadStreamRef readStream = NULL;
-  CFWriteStreamRef writeStream = NULL;
-  CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (__bridge CFStringRef)hostname, port, &readStream, &writeStream);
-  return [self initWithReadStream:readStream writeStream:writeStream];
-}
-
-- (id) initWithPath: (NSString *) path
-{
-  CFSocketNativeHandle sockfd = socket(AF_LOCAL, SOCK_STREAM, IPPROTO_IP);
-  int yes = 1;
-  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0)
-  {
-    NSLog(@"TSocketTransport: Unable to set REUSEADDR property of socket.");
-    return nil;
-  }
-
-  NSData *serverAddress = [[self class] createAddressWithPath:path];
-
-  CFReadStreamRef readStream = NULL;
-  CFWriteStreamRef writeStream = NULL;
-  CFStreamCreatePairWithSocket(kCFAllocatorDefault, sockfd, &readStream, &writeStream);
-  if (!readStream || !writeStream)
-  {
-    NSLog(@"TSocketTransport: Unable to create read/write stream pair for socket.");
-    return nil;
-  }
-
-  if (connect(sockfd, (struct sockaddr *)serverAddress.bytes, (socklen_t) serverAddress.length) < 0)
-  {
-    NSLog(@"TSocketTransport: Connect error: %s\n", strerror(errno));
-    return nil;
-  }
-
-  return [self initWithReadStream:readStream writeStream:writeStream];
-}
-
-+ (NSData *) createAddressWithPath: (NSString *)path
-{
-  struct sockaddr_un servaddr;
-
-  size_t nullTerminatedPathLength = path.length + 1;
-  if (nullTerminatedPathLength> sizeof(servaddr.sun_path)) {
-    NSLog(@"TSocketTransport: Unable to create socket at path %@. Path is too long.", path);
-    return nil;
-  }
-
-  bzero(&servaddr,sizeof(servaddr));
-  servaddr.sun_family = AF_LOCAL;
-  memcpy(servaddr.sun_path, path.UTF8String, nullTerminatedPathLength);
-  servaddr.sun_len = SUN_LEN(&servaddr);
-
-  return [NSData dataWithBytes:&servaddr length:sizeof(servaddr)];
-}
-
-
-@end
diff --git a/lib/cocoa/src/transport/TTransport.h b/lib/cocoa/src/transport/TTransport.h
deleted file mode 100644
index 558cf60..0000000
--- a/lib/cocoa/src/transport/TTransport.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-@protocol TTransport <NSObject>
-
-/**
- * Guarantees that all of len bytes are read
- *
- * @param buf Buffer to read into
- * @param off Index in buffer to start storing bytes at
- * @param len Maximum number of bytes to read
- * @return YES if succeeded, NO if failed
- * @throws TTransportError if there was an error reading data
- */
--(BOOL) readAll:(UInt8 *)buf offset:(UInt32)off length:(UInt32)len error:(NSError *__autoreleasing *)error;
-
--(UInt32) readAvail:(UInt8 *)buf offset:(UInt32)off maxLength:(UInt32)maxLen error:(NSError *__autoreleasing *)error;
-
--(BOOL) write:(const UInt8 *)data offset:(UInt32)offset length:(UInt32)length error:(NSError *__autoreleasing *)error;
-
--(BOOL) flush:(NSError *__autoreleasing *)error;
-
-@end
-
-
-NS_ASSUME_NONNULL_END
diff --git a/lib/cocoa/src/transport/TTransportError.h b/lib/cocoa/src/transport/TTransportError.h
deleted file mode 100644
index c8c9f06..0000000
--- a/lib/cocoa/src/transport/TTransportError.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TError.h"
-
-
-extern NSString *TTransportErrorDomain;
-
-
-typedef NS_ENUM (int, TTransportError) {
-  TTransportErrorUnknown        = 0,
-  TTransportErrorNotOpen        = 1,
-  TTransportErrorAlreadyOpen    = 2,
-  TTransportErrorTimedOut       = 3,
-  TTransportErrorEndOfFile      = 4,
-};
-
-
-extern NSString *TTransportErrorExtendedErrorKey;
-extern NSString *TTransportErrorHttpErrorKey;
-
-
-typedef NS_ENUM(int, THttpTransportError) {
-  THttpTransportErrorInvalidResponse  = 1001,
-  THttpTransportErrorInvalidStatus    = 1002,
-  THttpTransportErrorAuthentication   = 1003,
-};
diff --git a/lib/cocoa/src/transport/TTransportError.m b/lib/cocoa/src/transport/TTransportError.m
deleted file mode 100644
index b1af076..0000000
--- a/lib/cocoa/src/transport/TTransportError.m
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TTransportError.h"
-
-
-NSString *TTransportErrorDomain = @"TTransportErrorDomain";
-
-
-NSString *TTransportErrorExtendedErrorKey = @"extendedError";
-NSString *TTransportErrorHttpErrorKey = @"httpError";
diff --git a/lib/cpp/test/OneWayTest.thrift b/lib/cpp/test/OneWayTest.thrift
index 127e9ff..102cf26 100644
--- a/lib/cpp/test/OneWayTest.thrift
+++ b/lib/cpp/test/OneWayTest.thrift
@@ -34,7 +34,6 @@
 namespace go onewaytest
 namespace php OneWayTest
 namespace delphi Onewaytest
-namespace cocoa OneWayTest
 namespace lua OneWayTest
 namespace xsd test (uri = 'http://thrift.apache.org/ns/OneWayTest')
 namespace netcore ThriftAsync.OneWayTest
diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift
index 3499ab5..e025b7f 100644
--- a/test/ThriftTest.thrift
+++ b/test/ThriftTest.thrift
@@ -22,22 +22,21 @@
  */
 
 namespace c_glib TTest
-namespace java thrift.test
 namespace cpp thrift.test
-namespace rb Thrift.Test
-namespace perl ThriftTest
 namespace csharp Thrift.Test
+namespace delphi Thrift.Test
+namespace go thrifttest
+namespace java thrift.test
 namespace js ThriftTest
-namespace st ThriftTest
+namespace lua ThriftTest
+namespace netcore ThriftTest
+namespace perl ThriftTest
+namespace php ThriftTest
 namespace py ThriftTest
 namespace py.twisted ThriftTest
-namespace go thrifttest
-namespace php ThriftTest
-namespace delphi Thrift.Test
-namespace cocoa ThriftTest
-namespace lua ThriftTest
+namespace rb Thrift.Test
+namespace st ThriftTest
 namespace xsd test (uri = 'http://thrift.apache.org/ns/ThriftTest')
-namespace netcore ThriftTest
 
 // Presence of namespaces and sub-namespaces for which there is
 // no generator should compile with warnings only
