I'm trying to import Agent Geometry Kit (https://github.com/hfossli/AGGeometryKit) which is written in Objective-C into a Swift project.
I start by copying all the source files into my project, then I create a bridge header file in which I import all the header files I just added (which looks like this https://gist.github.com/JeanCParis/97dc6c27c70a4f00dbb0)
My problem is that although all the imported classes and structs are now available in my project, unions like AGKQuad are not.
Am I doing something wrong, or are unions not usable in Swift and if so how can I best bypass this problem ? Many thanks in advance !
Jean-Christophe
EDIT : I'm still a neophyte in developing on IOS, but can't I just make a Objective-C class which I can call from my Swift project to "do the job" and send me the result I'm looking for ? I tried to do just that and it unfortunately does not give me the expected result, although it might be that I don't yet fully understanding how Agent Geometry Kit works (what the method does comes from the readme file on github)
@implementation DoTheJob
- (UIImageView*)DoDaJob:(UIImage*)image {
UIImageView *view = [[UIImageView alloc] initWithImage:image];
[view.layer ensureAnchorPointIsSetToZero]; // set the anchor point to [0, 0] (this method keeps the same position)
AGKQuad quad = view.layer.quadrilateral;
quad.br.x += 600; // shift bottom right x-value with 20 pixels
quad.br.y += 500; // shift bottom right y-value with 50 pixels
view.layer.quadrilateral = quad; // the quad is converted to CATransform3D and applied
printf("DoingDaJob");
return view;
}
@end
Should this work in principle ?