iphone - Which project template should I use for an iOS and Cocoa library? -


i have bunch of code in ios project (named "mylibs") re-use across different apps. drag mylibs project workspace of whatever app i'm creating. don't use unit tests per se, have buttons run through tests in iphone app.

i'm learning cocoa , divide library libs can use on both projects. thinking mycommonlibs (or myfoundationlibs), myioslibs , mycocoalibs.

however, when creating new project, must choose between ios app or cocoa app. looks though ios framework , library -> cocoa touch static library appropriate because links against foundation framework. on other hand, i'd prefer use application template if there no major drawbacks it.

i need able use mycommonlibs in both app types, of them useful both, such nsarray categories, etc.

which template should use mycommonlibs , must use library, framework (in mac os templates) or can use normal application template (as i've been doing far)?

  1. create ios framework & library project. let's call testlib.

  2. add new target (file > new > target) of type mac os x framework & library.

this way, can compile both ios library , mac os x library same project.

you can choose files included in each target. if want make class available both ios , mac os x, add both, , if want make available 1 platform, can add 1 lib.

as can see in screenshots below, sharedclass available in both libs, iosonlyclass available ios , maconlyclass available mac os x only.

enter image description here

enter image description here

you can add targets unit tests in same project.

to organize code, can put shared classes in group, , classes of each target in separate group.

enter image description here


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -