Re: Window With Transparent Background
> On Jan 24, 2017, at 6:58 PM, Ken Thomases wrote: > > I can't explain the differences in the two cases, but are you also setting > the window's opaque property to NO? If not, then setting the background > color to partially transparent is not sufficient to reliably make a window > transparent. That was a really good suggestion but unfortunately it does not work. [window setOpaque:NO]; // makes no difference After further investigation here is what I found out. Using the window background color property is unreliable with or without alpha. For example some rgb component values less than 1.0 are clamped. Also rgb components must conform to certain requirements to successfully produce a transparent background. A single color component value of rgb must be 1.0 or less as expected. However two color component values of rgb must be 0.588 or less and three color component values of rgb must be 0.572 or less to successfully produce a transparent background. A solution that works it to replace the window content view with a custom view that has a background color property. http://stackoverflow.com/questions/33595674/set-background-color-of-nswindow-with-appearance-set --Richard Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF to Word ( docx) Conversion
You might take a look back at the TextEdit source. It should be pretty straight forward to save as .rtf or .rtfd, if by table you mean you have a rich text table. > On Jan 25, 2017, at 6:35, Peter Hudson wrote: > > I was trying to avoid having to go to Direct RTF markup. But as you say, it > may be the answer. > > Peter > >> On 24 Jan 2017, at 21:13, Jens Alfke wrote: >> >> >>> On Jan 24, 2017, at 12:58 PM, Peter Hudson wrote: >>> >>> I wondered about RTF - but I've built everything into a view and I can't >>> see a method on NSView to produce rtf. >>> I've done it previously with, I think, an NSText. >> >> I meant producing it programmatically. It’s a markup language, around the >> same order of complexity as HTML (although it looks more like TeX.) >> >> [Fun fact: My first paying job after college, in 1987, was to write a >> translator program that parsed a weird old phototypesetter markup language >> and generated RTF that could be imported into PageMaker.] >> >> —Jens > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com > > This email sent to dangerwillrobinsondan...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Window With Transparent Background
On Jan 24, 2017, at 11:17 AM, Richard Charles wrote: > > Consider a window presented as a sheet with background transparency. > > - (void)windowDidLoad > { >// Produces gray background with transparency. >NSColor *color = [NSColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.9]; >self.window.backgroundColor = color; > } > > - (void)windowDidLoad > { >// Produces near white background with no transparency. >NSColor *color = [NSColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:0.9]; >self.window.backgroundColor = color; > } > > The first case produces a background with transparency. > > The second case produces a background with no transparency. > > Why does’t the second case yield any transparency? I can't explain the differences in the two cases, but are you also setting the window's opaque property to NO? If not, then setting the background color to partially transparent is not sufficient to reliably make a window transparent. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Window With Transparent Background
> On Jan 24, 2017, at 5:07 PM, dangerwillrobinsondan...@gmail.com wrote: > > What is the point of a transparent sheet? This is somewhat similar to the connections panel in Interface Builder. When dragging to create a connection the opaque panel will change to semi-transparent. The user interacts with the sheet but the semi-transparent sheet does not completely obscure changes that occur in the document as a result of the user’s actions. The modal sheet stays attached to the document window reducing clutter and promoting a tidy interface. --Richard Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Window With Transparent Background
What is the point of a transparent sheet? I'm not sure that's supported. You might want to consider a child window instead. Much easier to be sure you can control its behaviors. Sent from my iPhone > On Jan 25, 2017, at 2:17, Richard Charles wrote: > > Consider a window presented as a sheet with background transparency. > > - (void)windowDidLoad > { >// Produces gray background with transparency. >NSColor *color = [NSColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.9]; >self.window.backgroundColor = color; > } > > - (void)windowDidLoad > { >// Produces near white background with no transparency. >NSColor *color = [NSColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:0.9]; >self.window.backgroundColor = color; > } > > The first case produces a background with transparency. > > The second case produces a background with no transparency. > > Why does’t the second case yield any transparency? > > --Richard Charles > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com > > This email sent to dangerwillrobinsondan...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF to Word ( docx) Conversion
I was trying to avoid having to go to Direct RTF markup. But as you say, it may be the answer. Peter > On 24 Jan 2017, at 21:13, Jens Alfke wrote: > > >> On Jan 24, 2017, at 12:58 PM, Peter Hudson wrote: >> >> I wondered about RTF - but I've built everything into a view and I can't see >> a method on NSView to produce rtf. >> I've done it previously with, I think, an NSText. > > I meant producing it programmatically. It’s a markup language, around the > same order of complexity as HTML (although it looks more like TeX.) > > [Fun fact: My first paying job after college, in 1987, was to write a > translator program that parsed a weird old phototypesetter markup language > and generated RTF that could be imported into PageMaker.] > > —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF to Word ( docx) Conversion
> On Jan 24, 2017, at 12:58 PM, Peter Hudson wrote: > > I wondered about RTF - but I've built everything into a view and I can't see > a method on NSView to produce rtf. > I've done it previously with, I think, an NSText. I meant producing it programmatically. It’s a markup language, around the same order of complexity as HTML (although it looks more like TeX.) [Fun fact: My first paying job after college, in 1987, was to write a translator program that parsed a weird old phototypesetter markup language and generated RTF that could be imported into PageMaker.] —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF to Word ( docx) Conversion
Hi Jens I wondered about RTF - but I've built everything into a view and I can't see a method on NSView to produce rtf. I've done it previously with, I think, an NSText. Peter > On 24 Jan 2017, at 20:27, Jens Alfke wrote: > > >> On Jan 24, 2017, at 11:54 AM, Peter Hudson wrote: >> >> But the bottom line is, I think, to get a Word doc that really behaves like >> a >> Word doc ( in word ) I need to export straight to docx format. > > Have you tried exporting to RTF? It’s a simple text-based markup format, and > imports well into Word. (In fact Microsoft invented RTF back in the ‘80s as > an interchange format for Word.) > > —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF to Word ( docx) Conversion
> On Jan 24, 2017, at 11:54 AM, Peter Hudson wrote: > > But the bottom line is, I think, to get a Word doc that really behaves like a > Word doc ( in word ) I need to export straight to docx format. Have you tried exporting to RTF? It’s a simple text-based markup format, and imports well into Word. (In fact Microsoft invented RTF back in the ‘80s as an interchange format for Word.) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Math question
> On Jan 24, 2017, at 11:36 AM, Eric E. Dolecki wrote: > > Never mind on that one. with a 0-100, it's super simple. But if it's 0 - 15 > that could be quite different. I'll noodle on that. The formula I gave is general purpose for mapping any input range to any output range. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF to Word ( docx) Conversion
Many thanks for this Charles. I'll check it out. Peter > On 24 Jan 2017, at 20:11, Charles Jenkins wrote: > > There is an open specification for the file format, which will allow you to > easily (if tediously) write your own exporter. > > The spec is at: > http://www.ecma-international.org/publications/standards/Ecma-376.htm > > (These are huge downloads) > > If you have access to a Windows PC, there is a Windows-based software > development kit INCLUDING an inspector that will let you open and inspect > documents. It is invaluable to be able to create a document in Word similar > to the one you need to generate, then save and inspect it to see what files > actually go inside. Unfortunately the inspector often refuses to open > malformed files, so you’ll be using it to see what you need to imitate, not > to gauge how far off you are from the mark. > > Those tools are at: > https://www.microsoft.com/en-us/download/details.aspx?id=30425 > > >> On Tue, Jan 24, 2017 at 2:54 PM, Peter Hudson wrote: >> Hi All >> >> I have a report that I currently print to PDF. >> Its a simple table with text ( varying fonts ) in the table. >> >> I have tried to convert it to docx with a variety of proprietary converters. >> One or two of them do a reasonable job. >> >> But the bottom line is, I think, to get a Word doc that really behaves like a >> Word doc ( in word ) I need to export straight to docx format. >> >> I’ve hunted around - but turned up little. >> Does anyone know of a library that could do it ? >> >> Peter >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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: >> https://lists.apple.com/mailman/options/cocoa-dev/cejwork%40gmail.com >> >> This email sent to cejw...@gmail.com > > > > -- > > Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF to Word ( docx) Conversion
There is an open specification for the file format, which will allow you to easily (if tediously) write your own exporter. The spec is at: http://www.ecma-international.org/publications/standards/Ecma-376.htm (These are huge downloads) If you have access to a Windows PC, there is a Windows-based software development kit INCLUDING an inspector that will let you open and inspect documents. It is invaluable to be able to create a document in Word similar to the one you need to generate, then save and inspect it to see what files actually go inside. Unfortunately the inspector often refuses to open malformed files, so you’ll be using it to see what you need to imitate, not to gauge how far off you are from the mark. Those tools are at: https://www.microsoft.com/en-us/download/details.aspx?id=30425 On Tue, Jan 24, 2017 at 2:54 PM, Peter Hudson wrote: > Hi All > > I have a report that I currently print to PDF. > Its a simple table with text ( varying fonts ) in the table. > > I have tried to convert it to docx with a variety of proprietary > converters. > One or two of them do a reasonable job. > > But the bottom line is, I think, to get a Word doc that really behaves > like a > Word doc ( in word ) I need to export straight to docx format. > > I’ve hunted around - but turned up little. > Does anyone know of a library that could do it ? > > Peter > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/cejwork%40gmail.com > > This email sent to cejw...@gmail.com -- Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
PDF to Word ( docx) Conversion
Hi All I have a report that I currently print to PDF. Its a simple table with text ( varying fonts ) in the table. I have tried to convert it to docx with a variety of proprietary converters. One or two of them do a reasonable job. But the bottom line is, I think, to get a Word doc that really behaves like a Word doc ( in word ) I need to export straight to docx format. I’ve hunted around - but turned up little. Does anyone know of a library that could do it ? Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Math question
Never mind on that one. with a 0-100, it's super simple. But if it's 0 - 15 that could be quite different. I'll noodle on that. On Tue, Jan 24, 2017 at 1:57 PM Eric E. Dolecki wrote: > Thanks so much, that works perfectly! > > Another quick question. > > distance of 100 = minimum value (say 0) > distance of 200 = maximum value (say 100) > > How can I apply that? I plan on Int for this value. > > > On Tue, Jan 24, 2017 at 1:52 PM Saagar Jha wrote: > > Not completely sure if this is what you want, but I think your “scale” > would be: > > scale = (distance - minDistance) / (maxDistance - minDistance) * (maxScale > - minScale) + minScale > > In this case, > > scale = (distance - 100) / 100 * 2 + 1 > > Saagar Jha > > On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki wrote: > > I have a situation where the distance of an onTouchesBegan in iOS produces > a scale for an object. > > min distance of 100 = scale of 1.0 > max distance of 200 = scale of 3.0 > > So I am looking for a number between 100 and 200 which ends up being > between 1.0 and 3.0. I can get the distance easily enough, but the scale > factor eludes me at the moment. Coffee? Lack of this kind of math for over > 20 years? Heh. > > self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y: > percentage) > > What math would I apply to get that range? > > Eric > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com > > This email sent to saa...@saagarjha.com > > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Math question
Thanks so much, that works perfectly! Another quick question. distance of 100 = minimum value (say 0) distance of 200 = maximum value (say 100) How can I apply that? I plan on Int for this value. On Tue, Jan 24, 2017 at 1:52 PM Saagar Jha wrote: > Not completely sure if this is what you want, but I think your “scale” > would be: > > scale = (distance - minDistance) / (maxDistance - minDistance) * (maxScale > - minScale) + minScale > > In this case, > > scale = (distance - 100) / 100 * 2 + 1 > > Saagar Jha > > On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki wrote: > > I have a situation where the distance of an onTouchesBegan in iOS produces > a scale for an object. > > min distance of 100 = scale of 1.0 > max distance of 200 = scale of 3.0 > > So I am looking for a number between 100 and 200 which ends up being > between 1.0 and 3.0. I can get the distance easily enough, but the scale > factor eludes me at the moment. Coffee? Lack of this kind of math for over > 20 years? Heh. > > self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y: > percentage) > > What math would I apply to get that range? > > Eric > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com > > This email sent to saa...@saagarjha.com > > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Math question
> On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki wrote: > > So I am looking for a number between 100 and 200 which ends up being > between 1.0 and 3.0. Are you talking about linear interpolation? That would be Set up the constants, as given in your email: let dist0 = 100, dist1 = 200 let scale0 = 1.0, scale1 = 3.0 Then given `dist` you get the matching `scale`: let scale = (dist - dist0) / (dist1 - dist0) * (scale1 - scale0) + scale0 Make sure everything’s converted to double if necessary. If the dist values end up typed as integers in the calculation, you’ll get hella roundoff error! —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Math question
Not completely sure if this is what you want, but I think your “scale” would be: scale = (distance - minDistance) / (maxDistance - minDistance) * (maxScale - minScale) + minScale In this case, scale = (distance - 100) / 100 * 2 + 1 Saagar Jha > On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki wrote: > > I have a situation where the distance of an onTouchesBegan in iOS produces > a scale for an object. > > min distance of 100 = scale of 1.0 > max distance of 200 = scale of 3.0 > > So I am looking for a number between 100 and 200 which ends up being > between 1.0 and 3.0. I can get the distance easily enough, but the scale > factor eludes me at the moment. Coffee? Lack of this kind of math for over > 20 years? Heh. > > self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y: > percentage) > > What math would I apply to get that range? > > Eric > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com > > This email sent to saa...@saagarjha.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Math question
I have a situation where the distance of an onTouchesBegan in iOS produces a scale for an object. min distance of 100 = scale of 1.0 max distance of 200 = scale of 3.0 So I am looking for a number between 100 and 200 which ends up being between 1.0 and 3.0. I can get the distance easily enough, but the scale factor eludes me at the moment. Coffee? Lack of this kind of math for over 20 years? Heh. self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y: percentage) What math would I apply to get that range? Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Window With Transparent Background
Consider a window presented as a sheet with background transparency. - (void)windowDidLoad { // Produces gray background with transparency. NSColor *color = [NSColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.9]; self.window.backgroundColor = color; } - (void)windowDidLoad { // Produces near white background with no transparency. NSColor *color = [NSColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:0.9]; self.window.backgroundColor = color; } The first case produces a background with transparency. The second case produces a background with no transparency. Why does’t the second case yield any transparency? --Richard Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
FSEventStreamCallback in Swift
My app shows a representation of the contents of various folders, so using FSEvents to track modifications from outside the app seemed to be the way to go. I am running into difficulty with writing the code with a callback, all in Swift. I must be doing something wrong, as I get a crash in the callback. Code in my ViewController class: let scanTarget = [] let scanCallback: FSEventStreamCallback = { (streamRef: ConstFSEventStreamRef, context: UnsafeMutableRawPointer?, count: Int, streamPtr: UnsafeMutableRawPointer, flags: UnsafePointer?, eventID: UnsafePointer?) in // Convert to appropriate pointer let theController = context?.bindMemory(to: ViewController.self, capacity: 1) // The following line crashes with a bad address exception theController?.pointee. } var mutableSelf = self var theContext = FSEventStreamContext(version: 0, info: &mutableSelf, retain: nil, release: nil, copyDescription: nil) let scanInterval: CFTimeInterval = 5.0 eventStream = FSEventStreamCreate(nil, scanCallback, &theContext, scanTarget as CFArray, FSEventStreamEventId(kFSEventStreamEventIdSinceNow), scanInterval, FSEventStreamCreateFlags(kFSEventStreamCreateFlagUseCFTypes)) I may well have the wrong way of handling the conversion through the context with all the unsafe pointer types, as I'm still rather new to Swift. -- John Brownie In Finland on furlough from SIL Papua New Guinea ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com