Mohsin Qureshi Mohsin Qureshi - 7 months ago 71
iOS Question

How we can Import Objective-C Constants as Swift Types?

I want to declare constant in

Swift 3
. For example if we have following constant in Objective-C :

HK_EXTERN NSString * const HKQuantityTypeIdentifierHeight;
HK_EXTERN NSString * const HKQuantityTypeIdentifierBodyMass;


Add New Swift file : Constant.swift

import Foundation
import HealthKit

let HK_EXTERN_Height : NSString = HKQuantityTypeIdentifierHeight
let HK_EXTERN_BodyMass : NSString = HKQuantityTypeIdentifierBodyMass

Use in ViewController.swift


Hope this help you....