Objective-c Property returns 'nil' in Swift 3 -
audio.h
@property(nonatomic,readwrite) int count;
audio.m
_count = 0; count++;
viewcontroller.swift
var audioswift: audio? print(audioswift?.count)
this returns 'nil' , want have modified valued
-bdridging-header.h
#import "audio.h"
what do? thank you!
don't post answers in comments.
here complete answer:
the problem never create audio object, audioswift
variable indeed nil.
change swift code this:
var audioswift = audio() //create new audio object. print(audioswift.count)
since code above creates audio object right away, doesn't need optional more.
note in both swift , objective-c class names should start upper-case letter, audio
class should named audio
instead.
Comments
Post a Comment