Re: Sharing code between screensaver and regular app
Re: Sharing code between screensaver and regular app
- Subject: Re: Sharing code between screensaver and regular app
- From: Dave via Cocoa-dev <email@hidden>
- Date: Mon, 2 Mar 2020 11:33:27 +0100
Hi,
You need to create a project with the right template to start with. In XCode:
File/New Project - Select MacOS and then “App” (from the New Project Dialog).
On XCode 11.0 and MacOS 10.14.6, this results in a new project Setup with a
view controller.
There are a number of ways to share code between Apps.
I usually have a folder structure like this:
CommonSource
ScreenSaver
StandaloneApp
Put the code that is common between the two into “CommonSource” and the App
Specific Stuff into either “ScreenSaver” or “StandaloneApp”. Then add the
common files to both projects and compile as normal.
All the Best
Dave
> On 1 Mar 2020, at 23:26, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> I am trying to replicate what this guy suggests:
>
> https://medium.com/better-programming/how-to-make-a-custom-screensaver-for-mac-os-x-7e1650c13bd8
> under section "Additional Debugging".
>
> The idea is to create a standalone app that shares as much code with the
> screensaver as possible.
>
> I am using Xcode 11, macOS Catalina, Objective-C.
>
> Now, I have created a new project as "App".
> But, unlike on the web page, Xcode has not created an NSViewController, but
> instead an NSObject:
> the .h-file contains
>
> @interface AppDelegate : NSObject <NSApplicationDelegate>
>
> @end
>
>
> Could some kind should please shed light on what to do to make my
> ScreenSaverView a subview of the new stand-alone app?
>
>
> Best regards, Gabriel
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden