aboutsummaryrefslogtreecommitdiff
path: root/test cases/swift/11 mixed objcpp/mylib.mm
blob: f7e9ab3f1dea388d2c50959f5b2c9db455300508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "mylib.h"
#include <iostream>

Test::Test() {
    std::cout << "Test initialized" << std::endl;
}

void Test::testCallFromClass() {
    std::cout << "Calling Objective-C++ class function from Swift is working" << std::endl;
}

@implementation ObjCPPTest
- (id)init {
    self = [super init];
    if (self) {
        test = new Test();
    }
    return self;
}

- (void)dealloc {
    delete test;
    [super dealloc];
}

- (void)testCallToObjCPP {
    test->testCallFromClass();
}
@end