ios - Swift generated header missing external swift frameworks -


i'm running issues swift generated header. swift classes in swift generated header aren't including properties or methods swift frameworks installed via cocoapods.

here's doing.

  1. i have xcode project pure objective-c.

  2. i added swift class (model.swift) project handles networking calls , syncing json responses coredata. swift class using alamofire networking calls.

  3. i setup xcode build settings generate projectname-swift.h

    • define module yes
    • added product module name
  4. when view model.swift class in swift generated header, function calls missing. missing function call's return request objects alamofire. appears when xcode build's swift header, unable see alamofire.

here things i've checked.

  1. my model.swift public. class marked public, , functions want exposed public. generated swift header include marked public.
  2. i checked alamofire pods build settings, framework public , define modules set yes. has it's own generated 'alamofire-swift.h'.

i'm running xcode 7.2 minimum deployment target of ios 8

i'm using cocoapods 0.39

here sample of cocoapods.

source 'https://github.com/cocoapods/specs.git' platform :ios, '8.0'  use_frameworks! pod 'alamofire', '3.1.2' 

is there else missing in order swift header generate code external swift frameworks?

my next step creating smaller project test. but, if isn't possible or missing know.

thanks all

update - created smaller xcode project in objective-c can see scaled down test version of model.swift , generated header.

import foundation import alamofire  public class model: nsobject {     public var mypropertya: string?     public var mypropertyb: int = 0      public override init()     {         super.init()     }      deinit     {      }      //mark: public methods      public func mypublicfunctiona() -> string?     {         return nil     }      public func mypublicfunctionb() -> int     {         return 0     }      public func simplerequest() -> request?     {         return nil     }      public func requestjson(method: alamofire.method, url: string?, parameters: [string: anyobject]?, headers: [string: string]?, complete: ((json: anyobject?, error: nserror?, erroroccurred: bool) -> void)?) -> request?     {         var request: request?         request = alamofire.request(method, url!, parameters: parameters, encoding: .url, headers: headers).validate().responsejson { response in              let json: anyobject? = response.result.value              switch response.result             {             case .success:                  if (complete != nil)                 {                     complete?(json: json, error: nil, erroroccurred: false)                 }                  break              case .failure(let error):                  if (complete != nil)                 {                     complete?(json: json, error: error, erroroccurred: true)                 }                  break             }         }          return request     } } 

and here swift header generated xcode. if scroll bottom see generated model.swift missing 2 functions require alamofire dependency. simplerequest , requestjson missing.

// generated apple swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81) #pragma clang diagnostic push  #if defined(__has_include) && __has_include(<swift/objc-prologue.h>) # include <swift/objc-prologue.h> #endif  #pragma clang diagnostic ignored "-wauto-import" #include <objc/nsobject.h> #include <stdint.h> #include <stddef.h> #include <stdbool.h>  #if defined(__has_include) && __has_include(<uchar.h>) # include <uchar.h> #elif !defined(__cplusplus) || __cplusplus < 201103l typedef uint_least16_t char16_t; typedef uint_least32_t char32_t; #endif  typedef struct _nszone nszone;  #if !defined(swift_paste) # define swift_paste_helper(x, y) x##y # define swift_paste(x, y) swift_paste_helper(x, y) #endif #if !defined(swift_metatype) # define swift_metatype(x) class #endif  #if defined(__has_attribute) && __has_attribute(objc_runtime_name) # define swift_runtime_name(x) __attribute__((objc_runtime_name(x))) #else # define swift_runtime_name(x) #endif #if defined(__has_attribute) && __has_attribute(swift_name) # define swift_compile_name(x) __attribute__((swift_name(x))) #else # define swift_compile_name(x) #endif #if !defined(swift_class_extra) # define swift_class_extra #endif #if !defined(swift_protocol_extra) # define swift_protocol_extra #endif #if !defined(swift_enum_extra) # define swift_enum_extra #endif #if !defined(swift_class) # if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)  #  define swift_class(swift_name) swift_runtime_name(swift_name) __attribute__((objc_subclassing_restricted)) swift_class_extra #  define swift_class_named(swift_name) __attribute__((objc_subclassing_restricted)) swift_compile_name(swift_name) swift_class_extra # else #  define swift_class(swift_name) swift_runtime_name(swift_name) swift_class_extra #  define swift_class_named(swift_name) swift_compile_name(swift_name) swift_class_extra # endif #endif  #if !defined(swift_protocol) # define swift_protocol(swift_name) swift_runtime_name(swift_name) swift_protocol_extra # define swift_protocol_named(swift_name) swift_compile_name(swift_name) swift_protocol_extra #endif  #if !defined(swift_extension) # define swift_extension(m) swift_paste(m##_swift_, __line__) #endif  #if !defined(objc_designated_initializer) # if defined(__has_attribute) && __has_attribute(objc_designated_initializer) #  define objc_designated_initializer __attribute__((objc_designated_initializer)) # else #  define objc_designated_initializer # endif #endif #if !defined(swift_enum) # define swift_enum(_type, _name) enum _name : _type _name; enum swift_enum_extra _name : _type #endif typedef float swift_float2  __attribute__((__ext_vector_type__(2))); typedef float swift_float3  __attribute__((__ext_vector_type__(3))); typedef float swift_float4  __attribute__((__ext_vector_type__(4))); typedef double swift_double2  __attribute__((__ext_vector_type__(2))); typedef double swift_double3  __attribute__((__ext_vector_type__(3))); typedef double swift_double4  __attribute__((__ext_vector_type__(4))); typedef int swift_int2  __attribute__((__ext_vector_type__(2))); typedef int swift_int3  __attribute__((__ext_vector_type__(3))); typedef int swift_int4  __attribute__((__ext_vector_type__(4))); #if defined(__has_feature) && __has_feature(modules) @import objectivec; #endif  #pragma clang diagnostic ignored "-wproperty-attribute-mismatch" #pragma clang diagnostic ignored "-wduplicate-method-arg"  swift_class("_ttc6mytest5model") @interface model : nsobject @property (nonatomic, copy) nsstring * __nullable mypropertya; @property (nonatomic) nsinteger mypropertyb; - (nonnull instancetype)init objc_designated_initializer; - (nsstring * __nullable)mypublicfunctiona; - (nsinteger)mypublicfunctionb; @end  #pragma clang diagnostic pop 


Comments