So far, my foray into Swift is going decently well. But I'm trying to re-write
some code that uses IOKit and , and while the IOKit calls are
fine, it doesn't like me trying to call fcntl(). It says, "Use of unresolved
identifier 'fcntl'".
I've tried including in my bridging header, I tried a f
On Oct 15, 2014, at 6:40 AM, Charles Jenkins wrote:
> Thanks for looking it over. :-) I guess I misunderstood the documentation. I
> thought if you dragged out a table view from the palette into a NIB, you got
> a full hierarchy of objects (including the extra scroll view I specifically
> don’
> On 18 Oct 2014, at 5:25 pm, Rick Mann wrote:
>
> So far, my foray into Swift is going decently well. But I'm trying to
> re-write some code that uses IOKit and , and while the IOKit
> calls are fine, it doesn't like me trying to call fcntl(). It says, "Use of
> unresolved identifier 'fcntl'
WebFrame *mainFrame = [ webView mainFrame ];
DOMDocument *domDoc = [ mainFrame DOMDocument ];
When I print domDoc, I get with 10.9 something like:
with 1 children
with 3 children
[ 0] with 15 children
[ 0] DOMText = "** white **"
Hi,
I am creating a Desktop issue tracking app using core data and the
NSDocument framework - so yes, the Xcode wizard extended
NSPersistentDocument which provides me with an NSManagedObjectContext.
My question is - if I start working in the app, creating issues for
instance ... when I go to actu
When using NSPersistentDocument it takes over responsibility for saving the
context. You should not save the context yourself.
> On 18 Oct 2014, at 17:00, Luther Baker wrote:
>
> Hi,
>
> I am creating a Desktop issue tracking app using core data and the
> NSDocument framework - so yes, the Xco
I'd like to save my Document based app in the bundle style format. IE: I'd
like to save things in a directory - like apps like OmniOutliner do.
Out of the box, I get the option to save as sqlite, binary or XML. What I'd
like is to save a 'bundle' with my own extension and nest things like the
the
Thanks Mike.
Let me ask another question ... what if I need to create a temporary,
thread specific NSManagedObjectContext? Let's say I'm interacting with a
RESTful API ala AFNetworking and I need to parse and save data on a
background response thread.
How do I tie my thread specific context into
> On 18 Oct 2014, at 17:06, Luther Baker wrote:
>
> I'd like to save my Document based app in the bundle style format. IE: I'd
> like to save things in a directory - like apps like OmniOutliner do.
>
> Out of the box, I get the option to save as sqlite, binary or XML. What I'd
> like is to save
> On 18 Oct 2014, at 17:09, Luther Baker wrote:
>
> Thanks Mike.
>
> Let me ask another question ... what if I need to create a temporary, thread
> specific NSManagedObjectContext? Let's say I'm interacting with a RESTful API
> ala AFNetworking and I need to parse and save data on a backgroun
Coming from an iOS background, I'm used to seeing (and encapsulating) the
creation of key Core Data components (persistent store, location,
contexts). Everything is pretty explicit and consequently easy to follow.
When I use Xcode to generate a desktop Document based app for me, that
functionality
Awesome! Thanks Mike.
By the way, I'm a happy Hit List user!
-Luther
On Sat, Oct 18, 2014 at 11:10 AM, Mike Abdullah
wrote:
>
> > On 18 Oct 2014, at 17:06, Luther Baker wrote:
> >
> > I'd like to save my Document based app in the bundle style format. IE:
> I'd
> > like to save things in
As an aside, I'm sure it is well-known, there is some funny caching going
on.
If I open the app the first time (and pre-populate the context with data) -
I cannot actually "SAVE".
If I formally shut the app down by quitting the app and choosing "Don't
Save", then subsequent restarts exhibit the s
Hi Roland,
Thanks for the followup. I've created a proper git rep on github rather than
just a gist. Most of my github reps seem to be this kind of mini demonstration
project and I was trying to avoid yet another one.
https://github.com/SheffieldKevin/swift-objectivec
> What version of Xcode a
> On 18 Oct 2014, at 17:33, Luther Baker wrote:
>
> As an aside, I'm sure it is well-known, there is some funny caching going on.
>
> If I open the app the first time (and pre-populate the context with data) - I
> cannot actually "SAVE".
>
> If I formally shut the app down by quitting the app
I've now found an acceptable solution.
Rather than a property I've added an optional method to the protocol which then
in its implementation assigns using the property, pretty much to make sure that
the function/block is copied. I declared the method like so:
-(void)applyMyCreateImageFunction:(
> On Oct 18, 2014, at 5:33 AM, Gerriet M. Denkmann wrote:
>
> Note: the head has only 12 children (the first 10 are identical to 10.9), and
> there is no body at all.
Weird! Are you sure that the page has finished loading by the time you made the
call? Maybe your code is running at a point wh
I need access to fcntl, so I thought I'd do what Apple does with Darwin. But I
don't actually see how to do that. They create Darwin.stdio.fopen(), for
example. But then how do they call the underlying C fopen()?
For that matter, Swift can call C functions directly in some cases, and not at
all
Hi, I have a parent view controller that has two UICollectionViewController
subclasses as children in its view controller hierarchy. I'd like to set
the parentViewController as the Subclass1CollectionViewController and
Subclass2CollectionViewControllers' .colllectionView UIScrollView delegate.
Howe
AFAIK, variadic C functions are not (yet) callable from swift code.
> Le 18 oct. 2014 à 20:37, Rick Mann a écrit :
>
> I need access to fcntl, so I thought I'd do what Apple does with Darwin. But
> I don't actually see how to do that. They create Darwin.stdio.fopen(), for
> example. But then
On Oct 18, 2014, at 2:22 PM, Mazzaroth M. wrote:
>
> Hi, I have a parent view controller that has two UICollectionViewController
> subclasses as children in its view controller hierarchy. I'd like to set
> the parentViewController as the Subclass1CollectionViewController and
> Subclass2Collection
It looks like a couple of people have asked about this in the past, but none of
the answers are working for me. I am trying to clear the contents of a
NSSearchField and have it go back to its empty state. I don’t have a
pre-Yosemite Mac handy to check if this is a bug / new behavior in Yosemit
Yeah, I tried that initially. An invalid parameter exception comes flying out
of NSCell’s setStringValue.
> On Oct 18, 2014, at 14:59, Gerd Knops wrote:
>
> Did you try to set it ti nil instead of an empty string?
>
> Gerd
>
>> On Oct 18, 2014, at 4:51 PM, Randy Widell wrote:
>>
>> It loo
I’m learning about toolbar buttons/icons on Yosemite (probably not much
different than before, but…I’m an iOS guy so its new for me). I have a few
basic, 101-style questions that I hope somebody can point me to the right place
for:
1. How do you do a popup menu button like the sidebar icon with
On Sat, Oct 18, 2014, at 04:51 PM, Randy Widell wrote:
> That works somewhat, but not really. Half the time the search field
> remains the first responder as if the call to set the outline view as the
> first responder never happened.
Have you tried forcing the text field to give up first respond
> On 19 Oct 2014, at 5:23 am, Jean-Daniel Dupas wrote:
>
> AFAIK, variadic C functions are not (yet) callable from swift code.
>
>
They aren’t - I didn’t remember fnctl() was varidadic. I shall quote an Apple
engineer then ..
"This is not possible in Swift. C variadics are inherently unsafe
Yeah, that doesn’t work either. I’m clearing the search field in response to a
change in selection in an outline view. Which means the search field is
already not the first responder. So, setting the first responder to nil just
makes the outline view give up first responder without affecting
1) This is pretty easy. Just create a Pop Up Button, then switch its style to
“Pull Down”. This will give you a push button with the single down arrow on
the right. Then just edit the Pop Up Button’s menu. You can give it an icon,
and then size it down horizontally so that only the icon is v
On Oct 18, 2014, at 8:31 PM, Randy Widell wrote:
> 1) This is pretty easy. Just create a Pop Up Button, then switch its style
> to “Pull Down”. This will give you a push button with the single down arrow
> on the right. Then just edit the Pop Up Button’s menu. You can give it an
> icon, and
Sorry, forgot that giving the Pop Up Button an icon isn’t exactly
straightforward. You want to create an menu item at the top of the menu that
has the icon but no text. Then add the rest of your menu items below it. The
Pop Up Button will display with the icon, but the first menu item will no
>
> I second this site. It’s really useful for finding icons. Just be warned that
> some of them don’t look like Apple icons and may feel out of place, even with
> the new flat design style.
>
Agreed. They work well for the application I am working on, but, yeah, that
might not be the case f
> On Oct 18, 2014, at 16:40 , Roland King wrote:
>
>
>> On 19 Oct 2014, at 5:23 am, Jean-Daniel Dupas wrote:
>>
>> AFAIK, variadic C functions are not (yet) callable from swift code.
>>
>>
>
> They aren’t - I didn’t remember fnctl() was varidadic. I shall quote an Apple
> engineer then ..
>> So you get to go wrap fcntl() in something else it seems.
>
> So, how would I do that, exactly? I suppose I have to pass Objective-C
> collection types to a method (which could be a straight C function) from a
> Swift call? That is, can a Swift variadic call translate into a C function
> ca
> On 19 Oct 2014, at 9:03 am, Rick Mann wrote:
>
>
>> On Oct 18, 2014, at 16:40 , Roland King wrote:
>>
>>
>>> On 19 Oct 2014, at 5:23 am, Jean-Daniel Dupas wrote:
>>>
>>> AFAIK, variadic C functions are not (yet) callable from swift code.
>>>
>>>
>>
>> They aren’t - I didn’t remember f
> On Oct 18, 2014, at 18:22 , Roland King wrote:
>
> Write a simple c wrapper around the thing you’re trying to do and that
> bridges across to swift. You could probably try to write something really
> generic which wraps fcntl() using an UnsafeMutablePtr as a final
> argument and then massag
Wait, if variadic calls aren't supported, how is it that NSLog() can be called?
> On Oct 18, 2014, at 18:22 , Roland King wrote:
>
>
>> On 19 Oct 2014, at 9:03 am, Rick Mann wrote:
>>
>>
>>> On Oct 18, 2014, at 16:40 , Roland King wrote:
>>>
>>>
On 19 Oct 2014, at 5:23 am, Jean-Danie
> On 19 Oct 2014, at 10:11 am, Rick Mann wrote:
>
> Wait, if variadic calls aren't supported, how is it that NSLog() can be
> called?
>
Probably has a version which takes a va_list.
type
import Swift
at the top of your swift file then Cmd Click on ‘Swift’ and you’ll find all
sorts of i
> On Oct 18, 2014, at 19:17 , Roland King wrote:
>
>
>> On 19 Oct 2014, at 10:11 am, Rick Mann wrote:
>>
>> Wait, if variadic calls aren't supported, how is it that NSLog() can be
>> called?
>>
>
> Probably has a version which takes a va_list.
>
> type
>
> import Swift
>
> at the top
>
> That's what I ended up doing (setNonblocking(int inFileDescriptor)), but, I
> was asking for the sake of learning the language. It would be nice to have
> generic replacements for fcntl() and ioctl().
>
The best replacement would be to have a set of functions which took the Swiss
Army kni
I agree, it's just a lot of work for someone (not me; I will only wrap the
things I need).
> On Oct 18, 2014, at 19:33 , Roland King wrote:
>
>>
>> That's what I ended up doing (setNonblocking(int inFileDescriptor)), but, I
>> was asking for the sake of learning the language. It would be nice
In Obj-C, I typically subclass NSWindowController and override -init to call
-initWithNibName:. I do this so the caller doesn't have to worry about how to
make one of these window controllers:
@implementation MyWindowController
- (id) init
{
self = [super initWithWindowNibName: "MyWindow" o
In an NSWindowController subclass init method, I want to call
-loadNibNamed:owner:topLevelObjects, but that requires I have a bundle. I can
get the main bundle, but I'd rather get the bundle for this class (makes it
useable in unit tests).
But, inside an init method, I'm not allowed to referenc
Hi Rick,
According to the latest documentation pack that arrived on Thursday, Swift has:
convenience init(windowNibName windowNibName: String,
owner owner: AnyObject)
So just use this. Like C++, Swift has overloaded method names, so 'init' can
take various parameter combinations.
I realize, in this case, I should be loading in loadWindow(), but it still
seems problematic.
> On Oct 18, 2014, at 20:25 , Rick Mann wrote:
>
> In an NSWindowController subclass init method, I want to call
> -loadNibNamed:owner:topLevelObjects, but that requires I have a bundle. I can
> get
On 19 Oct 2014, at 2:25 pm, Rick Mann wrote:
> In an NSWindowController subclass init method, I want to call
> -loadNibNamed:owner:topLevelObjects, but that requires I have a bundle. I can
> get the main bundle, but I'd rather get the bundle for this class (makes it
> useable in unit tests).
> On Oct 18, 2014, at 20:33 , Graham Cox wrote:
>
> According to the latest documentation pack that arrived on Thursday, Swift
> has:
>
> convenience init(windowNibName windowNibName: String,
> owner owner: AnyObject)
>
> So just use this. Like C++, Swift has overloaded method names
> On Oct 18, 2014, at 20:36 , Graham Cox wrote:
>
>
> On 19 Oct 2014, at 2:25 pm, Rick Mann wrote:
>
>> In an NSWindowController subclass init method, I want to call
>> -loadNibNamed:owner:topLevelObjects, but that requires I have a bundle. I
>> can get the main bundle, but I'd rather get t
On 19 Oct 2014, at 2:43 pm, Rick Mann wrote:
> Sorry, I was conflating Obj-C and Swift syntax. I'm trying to do this all in
> swift, in which case it's:
>
> NSBundle(forClass: self.dynamicType)
>
> But you can't call this in an initializer before calling super init.
>
Well, I'm not w
> On Oct 18, 2014, at 20:47 , Graham Cox wrote:
>
>
> On 19 Oct 2014, at 2:43 pm, Rick Mann wrote:
>
>> Sorry, I was conflating Obj-C and Swift syntax. I'm trying to do this all in
>> swift, in which case it's:
>>
>> NSBundle(forClass: self.dynamicType)
>>
>> But you can't call this i
Is it possible to keep an NSComboBox in the tabbing ring if I set its
"Behavior" to "Selectable". Tabbing reaches the control if the textfield is
editable but I don't want to allow the user to type randomly into the text
field ... but unfortunately, once I remove its editability, the tabbing
cycle
> On 19 Oct 2014, at 00:52, Jens Alfke wrote:
>
>
>> On Oct 18, 2014, at 5:33 AM, Gerriet M. Denkmann
>> wrote:
>>
>> Note: the head has only 12 children (the first 10 are identical to 10.9),
>> and there is no body at all.
>
> Weird! Are you sure that the page has finished loading by the
On 19 Oct 2014, at 2:54 pm, Rick Mann wrote:
> You're probably right about that, but in this case, you wouldn't be able to
> pass self for owner:
True, but since Swift has the other form of init anyway, you don't have to do
this yourself...
--Graham
__
(NB: This is a pure-Swift app, but I don't think that matters here).
OS X Storyboard app.
I set up a toolbar item with a sheet segue to a view controller. Works fine,
but I can't find an appropriate place to put the prepareForSegue() call. The
toolbar lives in the window, so I subclassed NSWind
I figured it out. I wasn't able to use "override" when defining my
prepareForSegue(), because I renamed the sender: parameter to inSender, not
realizing it needed the sender ahead of it. The example code from Apple only
had sender: AnyObject?. It was very confusing, because online and in the doc
> On 19 Oct 2014, at 11:42 am, Rick Mann wrote:
>
>
>> On Oct 18, 2014, at 20:33 , Graham Cox wrote:
>>
>> According to the latest documentation pack that arrived on Thursday, Swift
>> has:
>>
>> convenience init(windowNibName windowNibName: String,
>> owner owner: AnyObject)
>>
>
> On 19 Oct 2014, at 2:33 pm, Rick Mann wrote:
>
>
> Also, the background process that handles code completion keeps crashing, so
> my code completion was totally borked. Although, the first time it did work,
> it put in the override, but failed to put in the named second parameter.
>
Sourc
> On Oct 18, 2014, at 23:38 , Roland King wrote:
>
>
> The very first of those errors looks like you had the code in the wrong
> place, ie not within your class.
>
> Initialization is one of those Swift things which is uber-safe and thus very
> structured and hence in practice annoying.
>
57 matches
Mail list logo