0

Hello I have found two links about AVCam

  1. Apple: https://developer.apple.com/library/ios/samplecode/AVCam/History/History.html
  2. alex-chan/AVCamSwift: https://github.com/alex-chan/AVCamSwift

The first link has demo files that work perfectly, but its in Object-C - can someone show me documentation on converting Object-C to Swift?

The second link I have downloaded the files but it will not run in my 4s - can someone tell me why?

I would like to have a swift version so I can easily adopt it into my swift build + thanks again SO!

Paul Holness
  • 33
  • 10

1 Answers1

1

if you have a working objc version why not just import it with a bridging header? there is no one document about converting obj-c to swift, if you really want to convert it you are going to need to do it line by line.

also what exactly are you trying to do? get a live camera feed displayed? these docs have been ported to swift and would suit that purpose but you would need to get the input port first.

https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVCaptureVideoPreviewLayer_Class/index.html#//apple_ref/occ/clm/AVCaptureVideoPreviewLayer/layerWithSession:

Update: how to import obj-c headers, a newer way to create them that isnt quite as talked about yet is to just create any normal .m file or objective c file then select yes to creating a briding header, it configures everything for you. That being said it may be worth while to play around with the basics a bit more and maybe follow a few guides before attempting to implement this type of feature if you are having issues with following the links.

Here is a random application creation guide http://www.ioscreator.com/tutorials/calculator-tutorial-in-ios8-with-swift that should teach you alot. i would recommend following and reading through stuff like this until you have a bit more of a footing and can come up with more of an exact question. no one here is going to rewrite the apple program for you and your questions are extremely broad.

nsij22
  • 869
  • 10
  • 20
  • I don't know how to import it - I look online, Apple site, and in xCode and I cannot find a simple import button. The link you provided is a wealth of information, but I do not know how to implement it. – Paul Holness Dec 24 '14 at 02:04