As Gregory says, Apple’s "Using Swift with Cocoa and Objective-C” is your go-to reference here. In a nutshell, you have 2 challenges: (1) accessing your Objective-C code from Swift and (2) translating calls to that code to Swift syntax.
For (1) you just need to set up an Objective-C bridging header in your Swift project, and then import your Obj-C headers there. Note when you import Obj-C files into a Swift project Xcode will offer to create the bridging-header for you - which simplifies things considerably. For (2) you might also want to have a look at the EZAudio project on Github. That framework is written on top of Core Audio and most of the sample projects are in Objective-C, but the author recently added a sample Swift project to aid in exactly the sort of integration you’re looking to do (basically: making Swift calls to a C-based API). Translating something like a passed **float parameter into Swift is not necessarily immediately obvious, so you might find his example helpful. Best, Abel MOJO LAMA iOS Development, Audio Tools & Sound Vibrations www.mojolama.com > On Sep 15, 2015, at 3:00 PM, [email protected] wrote: > > Send Coreaudio-api mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.apple.com/mailman/listinfo/coreaudio-api > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Coreaudio-api digest..." > > > Today's Topics: > > 1. A Design question, using swift and objective-c (Rajesh Murugesan) > 2. Re: A Design question, using swift and objective-c > (Gregory Wieber) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 14 Sep 2015 16:14:45 -0400 > From: Rajesh Murugesan <[email protected]> > To: [email protected] > Subject: A Design question, using swift and objective-c > Message-ID: > <CAPayDN5_W4enkmjUDSXYFHtHn46SunNMriDKzErFi5FXfKp=v...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Hi All, > I am just starting to get into Core Audio. Especially using sf2 > font's and audio units. I have seen a few examples in objective-c. > > My question is, I will be developing a game in swift using spritekit. I > would rather have the midi logic in objective-c. So How do I go about > combining both? > >> From what I understand 1) There is a mix and match feature > 2) Then there is a guideline of > converting common objective-c code to swift > > Has anyone in this forum used any of the techniques? if you did, did you > run into problems? any resources that has an example with core audio? > > If anything, would be designing the game in swift and keeping core audio in > objective-c a good design? are there better approaches? > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > <https://lists.apple.com/mailman/private/coreaudio-api/attachments/20150914/51f8c7f2/attachment.html> > > ------------------------------ > > Message: 2 > Date: Mon, 14 Sep 2015 13:44:55 -0700 > From: Gregory Wieber <[email protected]> > To: Rajesh Murugesan <[email protected]> > Cc: [email protected] > Subject: Re: A Design question, using swift and objective-c > Message-ID: <[email protected]> > Content-Type: text/plain; charset=us-ascii > > Check out the sample code from this year's WWDC sessions on Core Audio which > show a combination of the two (three if you count C++) languages. > > As far as the general combination of the two languages, search Apple's site > for "Using Swift with Cocoa and Objective-C" which contains an in depth look > at interoperability > > Sent from my iPhone > >> On Sep 14, 2015, at 1:14 PM, Rajesh Murugesan <[email protected]> wrote: >> >> Hi All, >> I am just starting to get into Core Audio. Especially using sf2 >> font's and audio units. I have seen a few examples in objective-c. >> >> My question is, I will be developing a game in swift using spritekit. I >> would rather have the midi logic in objective-c. So How do I go about >> combining both? >> >> From what I understand 1) There is a mix and match feature >> 2) Then there is a guideline of >> converting common objective-c code to swift >> >> Has anyone in this forum used any of the techniques? if you did, did you run >> into problems? any resources that has an example with core audio? >> >> If anything, would be designing the game in swift and keeping core audio in >> objective-c a good design? are there better approaches? >> >> >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Coreaudio-api mailing list ([email protected]) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/coreaudio-api/gregorywieber%40gmail.com >> >> This email sent to [email protected] > > > > ------------------------------ > > _______________________________________________ > Coreaudio-api mailing list > [email protected] > https://lists.apple.com/mailman/listinfo/coreaudio-api > > End of Coreaudio-api Digest, Vol 12, Issue 152 > **********************************************
_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
