Re: Simple Swift question
Also the nifty new defer statement works well along with multiple guards if you need to do any cleanup when exiting the scope. The combination is great. Kevin On 29 Jun 2015, at 23:43, Rick Mann rm...@latencyzero.com wrote: On Jun 29, 2015, at 15:35 , Jens Alfke j...@mooseyard.com wrote: The unsightly nesting of the if-lets can be avoided with the nifty new ‘guard’ statement in Swift 2. Ah, yes, that's what I should be using. Thanks! -- Rick Mann rm...@latencyzero.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/ktam%40yvs.eu.com This email sent to k...@yvs.eu.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: UIPageViewController not resizing its child view controllers on rotation
On 30 Jun 2015, at 7:30 am, Devarshi Kulshreshtha devarshi.bluec...@gmail.com wrote: Though pagination control has resized properly, view of added view controller has not resized properly. You haven't said so, but I presume that the UIPageControl belongs to your root view, and not pagesContainerViewController's view? If so, the evidence suggests that autolayout is working correctly for the former but not the latter. And presuming that is the case, then my suspicion lies with this line: self.view.translatesAutoresizingMaskIntoConstraints = NO; It is unusual to specify translatesAutoresizingMaskIntoConstraints on oneself, since it is almost always one's parent who is responsible for one's positioning. And absent any other constraints, this will remove its autoresizing with respect to its superview. Hence, my guess is that the pagesContainerViewController's view has no constraints, and thus is getting unspecified layout (as manifest by its child UIPageViewController's view positioning). What happens if you delete that line? b ___ 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: Would you pay for a better table view?
On 30 Jun 2015, at 4:10 pm, Michael David Crawford mdcrawf...@gmail.com wrote: Cocoa Touch's table view works for simple things but it is painful for anything fancy. Have you checked out UICollectionView, or as of this month, UIStackView? Were I to write a better table view, would any of you fine folks be into licensing it for your own apps? That's a rather tough question to answer a priori, especially without knowing anything of its goals or what problems it tries to solve. But why don't you post some initial work to GitHub and see what develops? I once made what appeared to be a Mac OS List Manager list work with three billion items. Good for you. I also wrote a pretty sweet tree view control for MacZoop back in the Classic days -- unfortunately before I had the wisdom of proper and regular backups (seemingly no evidence remains). b ___ 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 Update Problem
Hi, ***Cross posted as it relates to both technologies*** I’ve asked this question before, but no one seems to know the answer. I’ve been hacking around with this both in an AppleScript and from Objective-C using the Scripting Bridge as well as the AppleScriptObjC Bridge, but nothing I’ve tried works, so if anyone has *any* idea how to make this work I’d be so happy to hear from you, on run tell application id com.microsoft.outlook activate set myTrickFlag to false --Set to true to close and open the window set myWindow to the front window if class of myWindow is not draft window then return Error not Draft Window end if save myWindow set myObjectID to the id of (object of myWindow) set myContent to the plain text content of message id myObjectID set myContent to myContent return Line Added return set the plain text content of (message id myObjectID) to myContent -- -- Doing this is the only way I can find to make the update appear in the window -- if myTrickFlag = true then close myWindow without saving open message id myObjectID end if end tell end run When I run this with myTrickFlag = false, you can see the message get updated in the Main Outlook Message Browser Window, but the Draft window that contains the text is NOT updated. If the user saves the window at this point, the updated content is lost. Under normal circumstances (e.g. not running a Script), Outlook would I suppose, would copy the window to the message at the appropriate point, so, if I could do the operation on the window version of the data, I suppose this stands a good chance of getting into the content, or I could just change both. I suppose I could keystroke into the content field, but I’ve been avoiding doing that as this is running in a time critical part of the code and I want the best performance as possible. I am assuming that keystroking is way more time consuming that just setting the data, please correct me if I’m wrong. I’ve also got the Scripting Bridge setup, so I can poke directly at the exposed properties, so if anyone can think of an event I could send that would do the trick please let me know. The other thing that occurs to me is that I can get the Global Window ID, so could drop into CF/CG if necessary. From my experimenting, I added this SB Code: myObjectPropertiesDictionary = myDraftObject.properties; //Equivalent of myDraftObject - the”object” property of the Draft Window in the above AS NSLog(@%@,[myObjectPropertiesDictionary allKeys]); myContentString = [myObjectPropertiesDictionary objectForKey:@plainTextContent]; [myDraftObject setValue:myNewContentString forKey:@plainTextContent”]; When I run this code, I get the following properties logged, but it crashes on the setValue:forKey statement as the class is not key-code compliant. Is there a way I can make use these properties to set a new value? hasHtml, sender, id, headers, isPartiallyDownloaded, repliedToAll, subject, smimeSigned, timeSent, modificationDate, isRightsProtected, account, redirected, folder, sendReadReceipt, priority, objectClass, dueDate, timeReceived, isMarkedForDelete, source, imapUid, smimeEncrypted, reminderDateTime, edited, isRead, completedDate, content, isMeeting, todoFlag, plainTextContent, repliedTo, categories, wasSent, isReadReceiptRequested, forwarded, startDate, exchangeId Anyway, if anyone has anything that they think might stand a chance of working, please let me know! Thanks a lot, All the Best Dave ___ 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: Subclassing a Subclass of SBApplication
Using class extension is probably a safe way to extends such classes. @interface SXPhotoshopApplication (MyExtension) - (void)myWrapper; @end Le 29 juin 2015 à 13:54, Dave d...@looktowindward.com a écrit : Hi, I’m using the Scripting Bridge, and I was wondering if it ok to subclass SBXXX classes. Basically, I have a header file generated by the “sdp” tool with definitions as below: And I’d like to subclass this to add some extra wrapping to hide some of the nastiness from the rest of the app and provide a tighter integration with the current app handling. I remember reading somewhere that these classes shouldn’t be subclassed, but I can’t seem to find it again now. Thanks a lot Dave - @interface SXPhotoshopApplication : SBApplication - (SBElementArray *) documents; - (SBElementArray *) fonts; - (SBElementArray *) notifiers; @property (copy, readonly) NSNumber *bestType; // the best type for the object's value @property (copy, readonly) NSNumber *defaultType; // the default type for the object's value @property (copy) NSDictionary *properties; // all of this object's properties returned in a single record @property (copy) SXPhotoshopColorValue *backgroundColor; @property (copy, readonly) NSString *build; // the build number of Adobe Photoshop application @property (copy) id colorSettings; // name of selected color settings' set @property (copy) SXPhotoshopDocument *currentDocument; // the frontmost document @property SXPhotoshopE050 displayDialogs; // controls whether or not Photoshop displays dialogs @property (copy) SXPhotoshopColorValue *foregroundColor; @property (readonly) double freeMemory; // the amount of unused memory available to Adobe Photoshop @property (readonly) BOOL frontmost; // is Photoshop the frontmost application? @property (copy, readonly) NSString *locale; // language locale of application @property (copy, readonly) NSArray *macintoshFileTypes; // list of file image types Photoshop can open @property (copy, readonly) NSString *name; // the application's name @property BOOL notifiersEnabled; // enable or disable all notifiers @property (copy, readonly) id preferencesFolder; // full path to the preferences folder @property (copy, readonly) NSArray *recentFiles; // files in the recent file list @property (copy, readonly) NSString *scriptingBuildDate; // the build date of the scripting interface @property (copy, readonly) NSString *scriptingVersion; // the version of the Scripting interface @property (copy, readonly) SXPhotoshopSettingsObject *settings; // preference settings @property (copy, readonly) NSString *systemInformation; // system information of the host application and machine @property (copy, readonly) NSString *version; // the version of Adobe Photoshop application @property (copy, readonly) NSArray *windowsFileTypes; // list of file image extensions Photoshop can open - (void) AETEScriptsScriptsJavaScriptNameName:(NSString *)JavaScriptNameName JavaScriptFileFile:(NSString *)JavaScriptFileFile JavaScriptTextText:(NSString *)JavaScriptTextText JavaScriptDebuggingDebugging:(BOOL)JavaScriptDebuggingDebugging JavaScriptMessageMessage:(NSString *)JavaScriptMessageMessage; // Photoshop scripting support plug-in - (void) open:(id)x as:(SXPhotoshopOpAs)as withOptions:(SXPhotoshopOpenOptions *)withOptions showingDialogs:(SXPhotoshopE050)showingDialogs smartObject:(BOOL)smartObject; // open the specified document file(s) - (void) print:(id)x sourceSpace:(SXPhotoshopE945)sourceSpace printSpace:(NSString *)printSpace intent:(SXPhotoshopE130)intent blackpointCompensation:(BOOL)blackpointCompensation; // print the specified object(s) - (void) quit; // quit the application - (NSArray *) PhotoshopOpenDialog; // use the Photoshop open dialog to select files - (NSString *) batch:(NSString *)x fromFiles:(NSArray *)fromFiles from:(NSString *)from withOptions:(SXPhotoshopBatchOptions *)withOptions; // run the batch automation routine - (NSString *) createPDFPresentationFromFiles:(NSArray *)fromFiles toFile:(id)toFile withOptions:(SXPhotoshopPresentationOptions *)withOptions; // create a PDF presentation file - (NSString *) createContactSheetFromFiles:(NSArray *)fromFiles withOptions:(SXPhotoshopContactSheetOptions *)withOptions; // create a contact sheet from multiple files - (NSString *) createPhotoGalleryFromFolder:(id)fromFolder toFolder:(id)toFolder withOptions:(SXPhotoshopGalleryOptions *)withOptions; // Creates a web photo gallery - (NSString *) createPhotoMergeFromFiles:(NSArray *)fromFiles; // DEPRECATED. Merges multiple files into one, user interaction required. - (NSString *) createPicturePackageFromFiles:(NSArray *)fromFiles withOptions:(SXPhotoshopPicturePackageOptions *)withOptions; // create a picture package from multiple files - (BOOL) featureEnabledName:(NSString
Re: File Permissions - NSFileManager Swift
On 30 Jun 2015, at 02:29, Jens Alfke j...@mooseyard.com wrote: It always helps people answer questions if you post the exact error you get. Generally when there are mysteriously un-deletable files, it has something to do with filesystem extended attributes like ‘immutable’. You can display these by using “ls -l@“. —Jens Thank you for replying. I was reporting the error I got back from the NSError, which doesn’t give much detail. Here’s the result of ls -l@: drwxrwxrwx+ 2 arved staff 68 30 Jun 15:13 Test.app From the Get Info window, there appears to be custom Access Control that NSFileManager.setAttributes() doesn’t alter. I don’t see anything else in the list of attributes that would alter the custom access. So, how do I change the permissions on the application (or any generic file) to have permission to delete it? Here’s a test application that is barebones what I’m trying to do: import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { let store: NSURL var item: NSURL? override init() { store = NSFileManager.defaultManager().URLsForDirectory(NSSearchPathDirectory.DesktopDirectory, inDomains: NSSearchPathDomainMask.UserDomainMask)[0] as! NSURL super.init() } @IBAction func addAppPackage(sender: AnyObject) { let op = NSOpenPanel() op.treatsFilePackagesAsDirectories = false op.allowsMultipleSelection = false op.canChooseDirectories = false op.canChooseFiles = true op.canCreateDirectories = false op.resolvesAliases = true op.allowedFileTypes = [public.executable] op.prompt = Add Application op.beginSheetModalForWindow(NSApp.mainWindow!!, completionHandler: { returnCode in if returnCode == NSModalResponseOK { op.orderOut(sender) var error: NSError? = nil for pathURL in op.URLs { self.item = self.store.URLByAppendingPathComponent(pathURL.lastPathComponent) NSFileManager.defaultManager().copyItemAtURL(pathURL as! NSURL, toURL: self.item!, error: error) } if error != nil { NSApp.presentError(error!, modalForWindow: NSApp.mainWindow!!, delegate: nil, didPresentSelector: nil, contextInfo: nil) } } }) } @IBAction func removeAppPackage(sender: AnyObject) { let alert = NSAlert() alert.messageText = Delete Application alert.informativeText = Are you sure? alert.addButtonWithTitle(Cancel) alert.addButtonWithTitle(Delete) alert.alertStyle = NSAlertStyle.CriticalAlertStyle alert.beginSheetModalForWindow(NSApp.mainWindow!!, completionHandler: { returnCode in if returnCode == NSAlertSecondButtonReturn { var error: NSError? = nil NSFileManager.defaultManager().setAttributes([NSFilePosixPermissions: 0o777], ofItemAtPath: self.item!.path!, error: error) NSFileManager.defaultManager().removeItemAtPath(self.item!.path!, error: error) if error != nil { alert.window.orderOut(sender) NSApp.presentError(error!, modalForWindow: NSApp.mainWindow!!, delegate: nil, didPresentSelector: nil, contextInfo: nil) // Error - Don’t have permission to remove file } } }) } } ___ 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: Cheating a synchronous call on the main thread
Hi, I do something like this which works really well but NOT on the Main Thread, on a background thread. -(NSData*) performSyncRequest { dispatch_group_tmyDispatchGroup; //** //**Create and Enter a Dispatch Group //** myDispatchGroup = dispatch_group_create(); dispatch_group_enter(myDispatchGroup); [self doSomethingWithCompletionHandler: ^(NSError* theErrorInfo) { //** //**Signal Response Received //** dispatch_group_leave(myDispatchGroup); } ]; //** //**Wait for the Response - Check for Time-Out Error //** myTimeOutStatus = dispatch_group_wait(myDispatchGroup,dispatch_time(DISPATCH_TIME_NOW,kLTWNetworkOperationTimeOutPeriodNS)); if (myTimeOutStatus != 0) { dispatch_group_leave(myDispatchGroup); } //** //**Handle Request Completed - Perform any delegate methods //** NSData* myRequestData = [self getData]; dispatch_release(myDispatchGroup); return myRequestData; } Cheers Dave On 29 Jun 2015, at 17:14, Gavin Eadie ga...@umich.edu wrote: It’s standard knowledge that any operation which causes an app’s main thread to wait is bad, and that diverting such delays off the main thread allows the app to remain optimally responsive to external events. That diversion can happen via a couple of mechanisms: ‘callbacks’ (delegation and closures) that are inherent in an API; and explicit transfer via GCD (or NSOperation at a more abstract level). My question for the list originates with a friend who is updating an app in which previously synchronous call needs to be replaced by asynchronous one (a Image Capture Core method, using a delegate). Leaving aside, if possible, the reasons for this, he has retained an apparent synchronous nature of the original call by wrapping the new ‘requestSend..’ method and its corresponding ‘didSend..’ delegate so that the wrapper appears to block its thread while actually allowing the main run loop to execute. The intent is to have code of the form: .. before fakeSyncrony after .. where, though “fakeSyncrony” is actually internally asynchronous, “after” is not executed till after the its delegate action completes. This works well if the above code executes off the main thread because any waiting inside “fakeSyncrony” can happen in the main run-loop and responsiveness is retained. It does not work if that code is on the main thread because there’s no way to put the waiting on the, now already occupied, main thread, and that’s where the question lies. While it seems clear to me and my friend that this in an inescapable fact of life, we have a counterexample in the form of the Canon ED-SDK, which somehow does accomplish this. Can anyone, with more knowledge than we have, suggest a trick that allows an apparently synchronous call on the main thread without impacting performance? PS: If I was answering this question, I’d suggest getting off the main thread and not playing tricks. So the answer “Don’t do this!” is already very high on the list .. another answer, regardless of nastiness, does exist but it’s beyond my skill to devise, but there are much smarter people than I on this list! ___ 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/dave%40looktowindward.com This email sent to d...@looktowindward.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: Subclassing a Subclass of SBApplication
Hi and Thanks, yes a much better option. All the Best Dave On 30 Jun 2015, at 14:19, Jean-Daniel Dupas mail...@xenonium.com wrote: Using class extension is probably a safe way to extends such classes. @interface SXPhotoshopApplication (MyExtension) - (void)myWrapper; @end Le 29 juin 2015 à 13:54, Dave d...@looktowindward.com a écrit : Hi, I’m using the Scripting Bridge, and I was wondering if it ok to subclass SBXXX classes. Basically, I have a header file generated by the “sdp” tool with definitions as below: And I’d like to subclass this to add some extra wrapping to hide some of the nastiness from the rest of the app and provide a tighter integration with the current app handling. I remember reading somewhere that these classes shouldn’t be subclassed, but I can’t seem to find it again now. Thanks a lot Dave - @interface SXPhotoshopApplication : SBApplication - (SBElementArray *) documents; - (SBElementArray *) fonts; - (SBElementArray *) notifiers; @property (copy, readonly) NSNumber *bestType; // the best type for the object's value @property (copy, readonly) NSNumber *defaultType; // the default type for the object's value @property (copy) NSDictionary *properties; // all of this object's properties returned in a single record @property (copy) SXPhotoshopColorValue *backgroundColor; @property (copy, readonly) NSString *build; // the build number of Adobe Photoshop application @property (copy) id colorSettings; // name of selected color settings' set @property (copy) SXPhotoshopDocument *currentDocument; // the frontmost document @property SXPhotoshopE050 displayDialogs; // controls whether or not Photoshop displays dialogs @property (copy) SXPhotoshopColorValue *foregroundColor; @property (readonly) double freeMemory; // the amount of unused memory available to Adobe Photoshop @property (readonly) BOOL frontmost; // is Photoshop the frontmost application? @property (copy, readonly) NSString *locale; // language locale of application @property (copy, readonly) NSArray *macintoshFileTypes; // list of file image types Photoshop can open @property (copy, readonly) NSString *name; // the application's name @property BOOL notifiersEnabled; // enable or disable all notifiers @property (copy, readonly) id preferencesFolder; // full path to the preferences folder @property (copy, readonly) NSArray *recentFiles; // files in the recent file list @property (copy, readonly) NSString *scriptingBuildDate; // the build date of the scripting interface @property (copy, readonly) NSString *scriptingVersion; // the version of the Scripting interface @property (copy, readonly) SXPhotoshopSettingsObject *settings; // preference settings @property (copy, readonly) NSString *systemInformation; // system information of the host application and machine @property (copy, readonly) NSString *version; // the version of Adobe Photoshop application @property (copy, readonly) NSArray *windowsFileTypes; // list of file image extensions Photoshop can open - (void) AETEScriptsScriptsJavaScriptNameName:(NSString *)JavaScriptNameName JavaScriptFileFile:(NSString *)JavaScriptFileFile JavaScriptTextText:(NSString *)JavaScriptTextText JavaScriptDebuggingDebugging:(BOOL)JavaScriptDebuggingDebugging JavaScriptMessageMessage:(NSString *)JavaScriptMessageMessage; // Photoshop scripting support plug-in - (void) open:(id)x as:(SXPhotoshopOpAs)as withOptions:(SXPhotoshopOpenOptions *)withOptions showingDialogs:(SXPhotoshopE050)showingDialogs smartObject:(BOOL)smartObject; // open the specified document file(s) - (void) print:(id)x sourceSpace:(SXPhotoshopE945)sourceSpace printSpace:(NSString *)printSpace intent:(SXPhotoshopE130)intent blackpointCompensation:(BOOL)blackpointCompensation; // print the specified object(s) - (void) quit; // quit the application - (NSArray *) PhotoshopOpenDialog; // use the Photoshop open dialog to select files - (NSString *) batch:(NSString *)x fromFiles:(NSArray *)fromFiles from:(NSString *)from withOptions:(SXPhotoshopBatchOptions *)withOptions; // run the batch automation routine - (NSString *) createPDFPresentationFromFiles:(NSArray *)fromFiles toFile:(id)toFile withOptions:(SXPhotoshopPresentationOptions *)withOptions; // create a PDF presentation file - (NSString *) createContactSheetFromFiles:(NSArray *)fromFiles withOptions:(SXPhotoshopContactSheetOptions *)withOptions; // create a contact sheet from multiple files - (NSString *) createPhotoGalleryFromFolder:(id)fromFolder toFolder:(id)toFolder withOptions:(SXPhotoshopGalleryOptions *)withOptions; // Creates a web photo gallery - (NSString *) createPhotoMergeFromFiles:(NSArray *)fromFiles; // DEPRECATED. Merges multiple files into one, user interaction required. - (NSString *) createPicturePackageFromFiles:(NSArray *)fromFiles
Re: Cheating a synchronous call on the main thread
Hi, This code (or the basis of it) was actually given to me by a Cocoa developer from this list. On 30 Jun 2015, at 15:19, Andreas Grosam agro...@onlinehome.de wrote: This kind of approach doesn't make sense and introduces a lot of issues. It does make sense for certain kinds of problems and in the context in which is was used, it made sense to do it this way. You occupy a thread which just waits for a result of a task (and thus merely blocks). The thread does other processing before and after this, and in the context it is used to it works fine with no or little noticeable difference. You doesn't cancel the async task properly when a timeout occurs. This is just sample the code, that I cut and pasted quickly, there are some bits missing, it the OP is interested I can send off list. And additionally you introduce a potential data race. It works fine in the context its used in. You could avoid all that by simply following asynchronous patterns: just implement the continuation (completion handler) of the already given asynchronous method. Unfortunately, In the real world that’s not always possible or desirable. Cheers Dave ___ 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: Cheating a synchronous call on the main thread
This kind of approach doesn't make sense and introduces a lot of issues. You occupy a thread which just waits for a result of a task (and thus merely blocks). You doesn't cancel the async task properly when a timeout occurs. And additionally you introduce a potential data race. You could avoid all that by simply following asynchronous patterns: just implement the continuation (completion handler) of the already given asynchronous method. Andreas Am 30.06.2015 um 12:20 schrieb Dave d...@looktowindward.com: Hi, I do something like this which works really well but NOT on the Main Thread, on a background thread. -(NSData*) performSyncRequest { dispatch_group_tmyDispatchGroup; //** //**Create and Enter a Dispatch Group //** myDispatchGroup = dispatch_group_create(); dispatch_group_enter(myDispatchGroup); [self doSomethingWithCompletionHandler: ^(NSError* theErrorInfo) { //** //**Signal Response Received //** dispatch_group_leave(myDispatchGroup); } ]; //** //**Wait for the Response - Check for Time-Out Error //** myTimeOutStatus = dispatch_group_wait(myDispatchGroup,dispatch_time(DISPATCH_TIME_NOW,kLTWNetworkOperationTimeOutPeriodNS)); if (myTimeOutStatus != 0) { dispatch_group_leave(myDispatchGroup); } //** //**Handle Request Completed - Perform any delegate methods //** NSData* myRequestData = [self getData]; dispatch_release(myDispatchGroup); return myRequestData; } Cheers Dave On 29 Jun 2015, at 17:14, Gavin Eadie ga...@umich.edu wrote: It’s standard knowledge that any operation which causes an app’s main thread to wait is bad, and that diverting such delays off the main thread allows the app to remain optimally responsive to external events. That diversion can happen via a couple of mechanisms: ‘callbacks’ (delegation and closures) that are inherent in an API; and explicit transfer via GCD (or NSOperation at a more abstract level). My question for the list originates with a friend who is updating an app in which previously synchronous call needs to be replaced by asynchronous one (a Image Capture Core method, using a delegate). Leaving aside, if possible, the reasons for this, he has retained an apparent synchronous nature of the original call by wrapping the new ‘requestSend..’ method and its corresponding ‘didSend..’ delegate so that the wrapper appears to block its thread while actually allowing the main run loop to execute. The intent is to have code of the form: .. before fakeSyncrony after .. where, though “fakeSyncrony” is actually internally asynchronous, “after” is not executed till after the its delegate action completes. This works well if the above code executes off the main thread because any waiting inside “fakeSyncrony” can happen in the main run-loop and responsiveness is retained. It does not work if that code is on the main thread because there’s no way to put the waiting on the, now already occupied, main thread, and that’s where the question lies. While it seems clear to me and my friend that this in an inescapable fact of life, we have a counterexample in the form of the Canon ED-SDK, which somehow does accomplish this. Can anyone, with more knowledge than we have, suggest a trick that allows an apparently synchronous call on the main thread without impacting performance? PS: If I was answering this question, I’d suggest getting off the main thread and not playing tricks. So the answer “Don’t do this!” is already very high on the list .. another answer, regardless of nastiness, does exist but it’s beyond my skill to devise, but there are much smarter people than I on this list! ___ 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/dave%40looktowindward.com This email sent to d...@looktowindward.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/agrosam%40onlinehome.de This email sent to agro...@onlinehome.de ___ 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:
Window Update Problem
Hi, ***Cross posted as it relates to both technologies*** I’ve asked this question before, but no one seems to know the answer. I’ve been hacking around with this both in an AppleScript and from Objective-C using the Scripting Bridge as well as the AppleScriptObjC Bridge, but nothing I’ve tried works, so if anyone has *any* idea how to make this work I’d be so happy to hear from you, on run tell application id com.microsoft.outlook activate set myTrickFlag to false --Set to true to close and open the window set myWindow to the front window if class of myWindow is not draft window then return Error not Draft Window end if save myWindow set myObjectID to the id of (object of myWindow) set myContent to the plain text content of message id myObjectID set myContent to myContent return Line Added return set the plain text content of (message id myObjectID) to myContent -- -- Doing this is the only way I can find to make the update appear in the window -- if myTrickFlag = true then close myWindow without saving open message id myObjectID end if end tell end run When I run this with myTrickFlag = false, you can see the message get updated in the Main Outlook Message Browser Window, but the Draft window that contains the text is NOT updated. If the user saves the window at this point, the updated content is lost. Under normal circumstances (e.g. not running a Script), Outlook would I suppose, would copy the window to the message at the appropriate point, so, if I could do the operation on the window version of the data, I suppose this stands a good chance of getting into the content, or I could just change both. I suppose I could keystroke into the content field, but I’ve been avoiding doing that as this is running in a time critical part of the code and I want the best performance as possible. I am assuming that keystroking is way more time consuming that just setting the data, please correct me if I’m wrong. I’ve also got the Scripting Bridge setup, so I can poke directly at the exposed properties, so if anyone can think of an event I could send that would do the trick please let me know. The other thing that occurs to me is that I can get the Global Window ID, so could drop into CF/CG if necessary. From my experimenting, I added this SB Code: myObjectPropertiesDictionary = myDraftObject.properties; //Equivalent of myDraftObject - the”object” property of the Draft Window in the above AS NSLog(@%@,[myObjectPropertiesDictionary allKeys]); myContentString = [myObjectPropertiesDictionary objectForKey:@plainTextContent]; [myDraftObject setValue:myNewContentString forKey:@plainTextContent”]; When I run this code, I get the following properties logged, but it crashes on the setValue:forKey statement as the class is not key-code compliant. Is there a way I can make use these properties to set a new value? hasHtml, sender, id, headers, isPartiallyDownloaded, repliedToAll, subject, smimeSigned, timeSent, modificationDate, isRightsProtected, account, redirected, folder, sendReadReceipt, priority, objectClass, dueDate, timeReceived, isMarkedForDelete, source, imapUid, smimeEncrypted, reminderDateTime, edited, isRead, completedDate, content, isMeeting, todoFlag, plainTextContent, repliedTo, categories, wasSent, isReadReceiptRequested, forwarded, startDate, exchangeId Anyway, if anyone has anything that they think might stand a chance of working, please let me know! Thanks a lot, All the Best Dave ___ 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
UIPageViewController not resizing its child view controllers on rotation
I am trying to use UIPageViewController with view controllers added to it, problem is if I launch the app in portrait mode it appears perfectly like this: http://i.stack.imgur.com/ryT5d.png but if I rotate the device to landscape mode it appears like this: http://i.stack.imgur.com/GnuYH.png Though pagination control has resized properly, view of added view controller has not resized properly. Below is the code which I have used to add respective view controller as root view controller in AppDelegate: pagesContainerViewController = [[RWPagesContainerViewController alloc] initWithNibName:@RWPagesContainerViewController bundle:nil]; [pagesContainerViewController loadPaginationControlAtIndex:0]; self.window.rootViewController = pagesContainerViewController; Here is the implementation of loadPaginationControlAtIndex method: - (void)loadPaginationControlAtIndex:(RWPaginationView)viewIndex { _pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@FirstViewController bundle:nil]; SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@SecondViewController bundle:nil]; ThirdViewController *thirdViewController = [[ThirdViewController alloc] initWithNibName:@ThirdViewController bundle:nil]; _subviewControllers = @[firstViewController, secondViewController, thirdViewController]; [self.pageController setViewControllers:@[_subviewControllers[viewIndex]] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; [self addChildViewController:self.pageController]; [[self view] addSubview:[self.pageController view]]; UIView *insertedView = self.pageController.view; insertedView.translatesAutoresizingMaskIntoConstraints = NO; self.view.translatesAutoresizingMaskIntoConstraints = NO; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@H:|[insertedView]| options:0 metrics:nil views:NSDictionaryOfVariableBindings(insertedView)]]; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@V:|[insertedView]| options:0 metrics:nil views:NSDictionaryOfVariableBindings(insertedView)]]; [self.view layoutIfNeeded]; self.pageController.dataSource = self; } Am I missing anything? Please suggest. -- Thanks, Devarshi ___ 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: Cheating a synchronous call on the main thread
Well, actually not quite true. Pthreads has that mechanism with the join facility. I like pthreads (er.. did before I began to grok GCD), but personally have no use for pthread-join, and definitely don’t recommend its use, but it does exactly this - waits for another thread to exit before continuing. Pthreads have been in OS X for a very long time… Now let me repeat. pthread_join is evil, bad, not to be used. There are much better ways of doing things, even in pthreads. And definitely not to be used in the main thread… - Jack Brindle On Jun 29, 2015, at 2:41 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jun 29, 2015, at 13:50 , Gavin Eadie ga...@umich.edu wrote: The main thread is not involved in the above, but the idea of an “asynchronous-that-waits” == “apparently synchronous” call is demonstrated. Yes, but you achieved that by blocking a background thread. It works because you don’t care that the thread is blocked. Incidentally, this sort of thing will break GCD. If the background thread was allocated to your block by GCD and it blocks, GCD will start another thread to do the next thing in the same queue. In a situation where this can happen repeatedly, you can end up with unlimited numbers of threads in flight simultaneously — unlimited until the system crashes, that is. OS X (and iOS) have *never* had a thread “yield” mechanism other than returning to the main event loop. That means that your only valid reply to the code’s author is, “There’s no way to do what you want.” The only exception to this statement — one that it’s really a bad idea to even present, since it reflects old-fashioned Cocoa design principles from the 1980s — is the idea of running the run loop modally, which is what buttons (e.g.) do when you click on them. But the real question is, what is the downside of re-factoring the code in the way Jens suggested? Has the code author tried? That’s what’s frustrating — after all this discussion, there’s a good chance that re-factoring will fall out problem-free with about 5 minutes of effort. ___ 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/jackbrindle%40me.com This email sent to jackbrin...@me.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 Update Problem
I’m not an AppleScript expert (well, not anymore - I used to know quite a bit, but that was ages ago) so I can’t really tell you if you’re going wrong, but… can I ask a kinda’ basic question? It appears that you are trying to send an email… can you talk to the server directly, instead of going thru Outlook? Would something like http://libmailcore.com help? (I’ve never used that myself, it’s just the first result that popped up in Google). ___ 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
NSTableView row heights with auto layout and bindings
Hi Im trying to fix a problem with dynamic row heights with auto layout and bindings which was working fine in an older build of Xcode but which now no longer works. So my new attempt for the most part works but about 30% of my row heights are not correctly calculated. Basically I create a reference NSTableCellView, set my model object as the objectValue which then updates the bindings, set the frame width of the reference cell to the column width then work out the height from there by setting preferredMaxLayoutWidth on the wrapping text field. Here's the code to do the calculation 1 - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row 2 { 3 static NSTableCellView *cellView = nil; 4 5 if (cellView == nil) { 6 NSDictionary *nibs = [tableView registeredNibsByIdentifier]; 7 NSNib *nib = nibs[@MainCellView]; 8 NSArray *topLevelObjects = nil; 9 10 [nib instantiateWithOwner:nil topLevelObjects:topLevelObjects]; 11 12 for (id object in topLevelObjects) { 13 if ([object isKindOfClass:[NSTableCellView class]]) { 14 cellView = object; 15 break; 16 } 17 } 18 } 19 20 LogEntryNode *node = self.logEntryNodes[row]; 21 22 cellView.objectValue = node; 23 24 NSTableColumn *tc = tableView.tableColumns[0]; 25 NSSize size = NSMakeSize(tc.width, 43.0); 26 27 [cellView setFrameSize:size]; 28 [cellView setNeedsLayout:YES]; 29 [cellView layoutSubtreeIfNeeded]; 30 31 cellView.textField.preferredMaxLayoutWidth = cellView.textField.frame.size.width; 32 33 CGFloat height = cellView.textField.intrinsicContentSize.height; 34 CGFloat padding = cellView.frame.size.height - cellView.textField.frame.size.height; 35 36 height += padding; 37 38 return (height 43.0) ? 43.0 : height; 39 } This seems to be the way Corbin Dunn recommends but that was without using auto layout. The calculated heights are usually out by anything from 2 to 5 rows of text. Has anyone had any success doing it this way? Is there something I'm missing? Any help would be appreciated. ___ 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: File Permissions - NSFileManager Swift
On Jun 30, 2015, at 6:26 AM, Arved von Brasch co...@atgo.org wrote: Thank you for replying. I was reporting the error I got back from the NSError, which doesn’t give much detail. Every NSError has an error domain and code, which is what I was asking for. Often there’s other useful metadata in the userInfo dictionary. From the debugger the “po” command will output a description of the error. drwxrwxrwx+ 2 arved staff 68 30 Jun 15:13 Test.app Those are just the attributes of the app directory itself. There’s probably some file inside there that can’t be deleted; you’ll have to use -R (or is it -r?) to recurse. So, how do I change the permissions on the application (or any generic file) to have permission to delete it? The system call removexattr, probably. See the man page. —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: Back-to-back NSOpenPanel runModal blocking each other
On Jun 30, 2015, at 12:55 , Sean McBride s...@rogue-research.com wrote: However, the panel itself doesn't always actually get visually removed from the screen before my loop spins around again and displays another open panel. In the dialog APIs that have a completion handler, there’s a free ‘orderOut:’ after the handler returns, if it didn’t do that already. I’d assume that this is is what’s internally causing the ‘orderOut:’ to happen later than you wish, and of course you have no direct control over this. Possible workarounds: 1. Don’t use a loop, but rather than a chain of dispatches. That is, put the prompt code in a block that takes some parameters, and at the end of the block do a dispatch_async (dispatch_get_main_queue (), …) of the block with some new parameters. This should queue your next dialog after a block that’s been queued to do the ‘orderOut:’, which will defer the new dialog until the old one is gone. (This is basically your ‘sleep’ workaround, but without any delay.) 2. Use ‘beginWithCompletionHandler:’ instead of ‘runModal’. The only downside is that it’s not modal, so the dialog could get hidden by other windows of your app, if the user clicks on the wrong thing. ___ 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: Back-to-back NSOpenPanel runModal blocking each other
On Tue, 30 Jun 2015 20:17:29 +, Quincey Morris said: In the dialog APIs that have a completion handler, there’s a free ‘orderOut:’ after the handler returns, if it didn’t do that already. I’d assume that this is is what’s internally causing the ‘orderOut:’ to happen later than you wish, and of course you have no direct control over this. Calling orderOut: myself (right after runModal) doesn't actually order the window out either. :( Possible workarounds: 1. Don’t use a loop, but rather than a chain of dispatches. That is, put the prompt code in a block that takes some parameters, and at the end of the block do a dispatch_async (dispatch_get_main_queue (), …) of the block with some new parameters. This should queue your next dialog after a block that’s been queued to do the ‘orderOut:’, which will defer the new dialog until the old one is gone. (This is basically your ‘sleep’ workaround, but without any delay.) 2. Use ‘beginWithCompletionHandler:’ instead of ‘runModal’. The only downside is that it’s not modal, so the dialog could get hidden by other windows of your app, if the user clicks on the wrong thing. Thanks for the suggestions. The difficulty will be that this old code really requires the synchronous nature of runModal, as the found NSURL must be returned up to the calling function. Really I should get around to cleaning it all up one day... :) Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Back-to-back NSOpenPanel runModal blocking each other
On Jun 30, 2015, at 13:41 , Sean McBride s...@rogue-research.com wrote: Calling orderOut: myself (right after runModal) doesn't actually order the window out either. :( Is this app sandboxed? If so, I wouldn’t expect that to do anything, since that’s not the window that’s onscreen. It’s in another process. this old code really requires the synchronous nature of runModal 'sleep (1)' sounds good. ___ 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
UITextFieldDelegate
I want to become more familiar with best practices using this delegate, and when not to use it. Can anyone point me in the right direction? Tutorials, etc.? Thanks. Sent from my iPad ___ 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
Back-to-back NSOpenPanel runModal blocking each other
Hi all, Should I be able to display one NSOpenPanel after another using runModal? Basically, I have a loop where I prompt users to manually find files when alias/bookmark resolution fails. I use the synchronous API runModal which displays a modal NSOpenPanel and returns only when the user has pressed OK/Cancel. However, the panel itself doesn't always actually get visually removed from the screen before my loop spins around again and displays another open panel. When that occurs, the new one gets shown *under* the old one, but the old one can't be interacted with and the new one is thus blocked. If I throw in a sleep(1) before showing a second one, things work as desired. Should what I'm trying to do work? Thanks, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Back-to-back NSOpenPanel runModal blocking each other
On Tue, 30 Jun 2015 20:50:06 +, Quincey Morris said: On Jun 30, 2015, at 13:41 , Sean McBride s...@rogue-research.com wrote: Calling orderOut: myself (right after runModal) doesn't actually order the window out either. :( Is this app sandboxed? No. If so, I wouldn’t expect that to do anything, since that’s not the window that’s onscreen. It’s in another process. Maybe these days it's even in another process for non-sandboxed apps... this old code really requires the synchronous nature of runModal 'sleep (1)' sounds good. Oh rather: good enough. :) Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Swift and parameter names
On Jun 29, 2015, at 15:42 , Rick Mann rm...@latencyzero.com wrote: Here's an example (and this is what I frequently encounter) where requiring parameter names adds nothing but clutter: let config = WKWebViewConfiguration() self.webView = WKWebView(frame: self.webViewContainer.frame, configuration: config); I’ve been thinking about this since yesterday, and while I don’t particularly agree that the parameter names are extraneous in *this* case, I can think of a couple of special cases: 1. If the function/method being called has extremely well-known parameters, then I think I’d prefer the function to have a form that omits the names. In particular, CGRect, CGPoint and CGSize: let rect = CGRect (x: 0, y: 0, width: 10, height: 10) // vs: let rect = CGRect (0, 0, 10, 10) The point here is that the parameter semantics are known from the *name* of the function, not from the actual parameters. We have this convention already, in the default behavior where the first keyword to a regular function/method is omitted: doSomethingWithRect (someRect) This is similar to the CGRect initializer case, in that we know from the name what the parameter is (because it tells us, in this case, not necessarily because we knew it in advance). 2. There’s common situation where a variable name very often *is* a parameter keyword. For example: init (frame: CGRect, configuration: WKWebViewConfiguration) { super.init (frame: frame, configuration: configuration) } In this case, the name of the variable in the ‘super’ call *is* the same as the keyword, because that’s a syntactic default in Swift. Under these circumstances, I could see this being allowed: init (frame: CGRect, configuration: WKWebViewConfiguration) { super.init (frame, configuration) } It may or may not be desirable to require that the keywords are all omitted or all retained, or that this would only work for parameter variables (which have a natural relationship to their keyword). What do you think? This wouldn’t eliminate all the cases you’ve set your sights on, but it would probably remove the most egregious ones. If there’s some consensus here, I’ll file radars. ___ 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: Swift and parameter names
On Jun 30, 2015, at 15:10 , Charles Srstka cocoa...@charlessoft.com wrote: This may be true for some cases, but I disagree with this particular example. Yes, you’re right. I simply zoned out when making up that name. I really meant something like ‘animateWithFrame’. However this example wasn’t to suggest anything new. I was just pointing out that we *already* omit the first keyword because by convention we know what it is from the method name. ___ 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
Would you pay for a better table view?
My own app would benefit from a better table view were I to write one from scratch. Cocoa Touch's table view works for simple things but it is painful for anything fancy. Were I to write a better table view, would any of you fine folks be into licensing it for your own apps? I once made what appeared to be a Mac OS List Manager list work with three billion items. Mike -- Michael David Crawford, Consulting Software Engineer mdcrawf...@gmail.com http://www.warplife.com/mdc/ Available for Software Development in the Portland, Oregon Metropolitan Area. ___ 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: Swift and parameter names
On Jun 30, 2015, at 4:46 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: 1. If the function/method being called has extremely well-known parameters, then I think I’d prefer the function to have a form that omits the names. In particular, CGRect, CGPoint and CGSize: let rect = CGRect (x: 0, y: 0, width: 10, height: 10) // vs: let rect = CGRect (0, 0, 10, 10) The point here is that the parameter semantics are known from the *name* of the function, not from the actual parameters. We have this convention already, in the default behavior where the first keyword to a regular function/method is omitted: doSomethingWithRect (someRect) This is similar to the CGRect initializer case, in that we know from the name what the parameter is (because it tells us, in this case, not necessarily because we knew it in advance). This may be true for some cases, but I disagree with this particular example. It is not at all clear what the parameters should be, simply by the name tells us it should be a rect. After all, there are multiple ways to define a rect with four numbers — the four parameters the classic Mac OS used to define a rect, for instance, were the positions of the top, left, bottom, and right edges. I’d say CGRect is definitely an instance where it seems intuitive because we’ve all been using NSMakeRect and the like for all these years, and we’re used to it. 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: Would you pay for a better table view?
On Jun 30, 2015, at 6:10 PM, Michael David Crawford mdcrawf...@gmail.com wrote: My own app would benefit from a better table view were I to write one from scratch. Cocoa Touch's table view works for simple things but it is painful for anything fancy. Were I to write a better table view, would any of you fine folks be into licensing it for your own apps? I once made what appeared to be a Mac OS List Manager list work with three billion items. Mike I don’t really have anything against NSTableView, and I assume Cocoa Touch’s table view is similar enough to that that I’d probably consider it quite good too. Now, if someone were to offer a better NSTreeController… that might be tempting. 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: Back-to-back NSOpenPanel runModal blocking each other
On Jun 30, 2015, at 2:55 PM, Sean McBride s...@rogue-research.com wrote: Hi all, Should I be able to display one NSOpenPanel after another using runModal? Basically, I have a loop where I prompt users to manually find files when alias/bookmark resolution fails. I use the synchronous API runModal which displays a modal NSOpenPanel and returns only when the user has pressed OK/Cancel. However, the panel itself doesn't always actually get visually removed from the screen before my loop spins around again and displays another open panel. When that occurs, the new one gets shown *under* the old one, but the old one can't be interacted with and the new one is thus blocked. If I throw in a sleep(1) before showing a second one, things work as desired. Should what I'm trying to do work? How about [NSAnimationContext currentContext].completionHandler = ^{ // do something }; ? Disclaimer: haven’t tested it myself, so I don’t know if it will do what you want, but it’s worth trying. 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