|
FYI: Mike Ash analyzes objc_msgsend
Mike Ash has been offline for a while, but his Friday Q&A is back with a detailed line-by-line analysis of the objc_msgsend function on ARM64. This is the core Objective-C runtime function that sends
Mike Ash has been offline for a while, but his Friday Q&A is back with a detailed line-by-line analysis of the objc_msgsend function on ARM64. This is the core Objective-C runtime function that sends
|
By
Jens Alfke
· #8
·
|
|
Alternative to Auto Layout?
That’s been my opinion of auto-layout too … in theory it should be awesome, but configuring it is ridiculously complex. Every iteration of IB seems to make some of the process easier, but adds more be
That’s been my opinion of auto-layout too … in theory it should be awesome, but configuring it is ridiculously complex. Every iteration of IB seems to make some of the process easier, but adds more be
|
By
Jens Alfke
· #14
·
|
|
Alternative to Auto Layout?
Great. Where’s that good guide? Xcode’s own documentation is so sparse as to be useless. The 3rd party books I’ve seen are massive doorstops aimed at newbies that spend 990 pages on the basics of Coco
Great. Where’s that good guide? Xcode’s own documentation is so sparse as to be useless. The 3rd party books I’ve seen are massive doorstops aimed at newbies that spend 990 pages on the basics of Coco
|
By
Jens Alfke
· #15
·
|
|
Alternative to Auto Layout?
“Why, I wouldn’t become a Mason now if you went down on your lousy stinking knees and begged me!” —John Cleese, “The Architect Sketch” No seriously, I hadn’t heard of this before, but it looks very pr
“Why, I wouldn’t become a Mason now if you went down on your lousy stinking knees and begged me!” —John Cleese, “The Architect Sketch” No seriously, I hadn’t heard of this before, but it looks very pr
|
By
Jens Alfke
· #21
·
|
|
Swift name manglings
Changing the target name changes the product name and module name (by default unless you explicitly specify them.) The references to your Swift classes in IB still have the old module name in them. Yo
Changing the target name changes the product name and module name (by default unless you explicitly specify them.) The references to your Swift classes in IB still have the old module name in them. Yo
|
By
Jens Alfke
· #27
·
|
|
How to write better Swift
You can implement a property observer instead. Here’s an example from the Swift book: class StepCounter { var totalSteps: Int = 0 { willSet(newTotalSteps) { print("About to set totalSteps to \(newTota
You can implement a property observer instead. Here’s an example from the Swift book: class StepCounter { var totalSteps: Int = 0 { willSet(newTotalSteps) { print("About to set totalSteps to \(newTota
|
By
Jens Alfke
· #33
·
|
|
Getting Started with Animations
Yup, I would recommend using CALayers for the whole UI, pretty much. Back when Core Animation first came out I wrote a framework for building board/card games: https://bitbucket.org/snej/geekgameboard
Yup, I would recommend using CALayers for the whole UI, pretty much. Back when Core Animation first came out I wrote a framework for building board/card games: https://bitbucket.org/snej/geekgameboard
|
By
Jens Alfke
· #59
·
|
|
Getting Started with Animations
It’s been years since I did much with CoreAnimation, but IIRC a layer is clipped to its parent layer, so if you want this to happen you need to make the view temporarily be a direct subview of your Ro
It’s been years since I did much with CoreAnimation, but IIRC a layer is clipped to its parent layer, so if you want this to happen you need to make the view temporarily be a direct subview of your Ro
|
By
Jens Alfke
· #62
·
|
|
WindowController
Have you made sure the “release on close” checkbox isn’t set in IB? (But do you really want the prefs controller to hang around when it’s closed? Seems like a waste of memory to me.) —Jens
Have you made sure the “release on close” checkbox isn’t set in IB? (But do you really want the prefs controller to hang around when it’s closed? Seems like a waste of memory to me.) —Jens
|
By
Jens Alfke
· #70
·
|
|
Trying to make Arc happy
I think you resolve this by changing it to the form shown in the error messages, i.e. - (BOOL)isNiceAndHas: (NSArray *__autoreleasing *)friends; —Jens
I think you resolve this by changing it to the form shown in the error messages, i.e. - (BOOL)isNiceAndHas: (NSArray *__autoreleasing *)friends; —Jens
|
By
Jens Alfke
· #98
·
|
|
dispatch_async question
The call you showed runs the block on the main thread. That aspect may be crucial. Does the code this is part of run on a different thread/queue? Also, it can often be very useful to defer some code u
The call you showed runs the block on the main thread. That aspect may be crucial. Does the code this is part of run on a different thread/queue? Also, it can often be very useful to defer some code u
|
By
Jens Alfke
· #111
·
|
|
Installing a Launchd.plist
LaunchDaemons is the wrong directory; that’s for system daemons that run outside of any user context. (I’m surprised you actually got this to work, because it’s difficult to present any UI from a daem
LaunchDaemons is the wrong directory; that’s for system daemons that run outside of any user context. (I’m surprised you actually got this to work, because it’s difficult to present any UI from a daem
|
By
Jens Alfke
· #118
·
|
|
"broken pipe", but not when debugging...
For some reason lost in ancient Unix history, if you write to a file-descriptor that’s been closed at the other end, a SIGPIPE signal is raised. This will by default kill your process. It’s annoying b
For some reason lost in ancient Unix history, if you write to a file-descriptor that’s been closed at the other end, a SIGPIPE signal is raised. This will by default kill your process. It’s annoying b
|
By
Jens Alfke
· #164
·
|
|
"broken pipe", but not when debugging...
It does seem absurd that the most fundamental APIs — the C standard library and POSIX/Darwin system calls — aren’t supported by Xcode’s documentation features. Especially since the header files give z
It does seem absurd that the most fundamental APIs — the C standard library and POSIX/Darwin system calls — aren’t supported by Xcode’s documentation features. Especially since the header files give z
|
By
Jens Alfke
· #176
·
|
|
APFS & FileSystem attributes
If it did, it would break most apps, so no. —Jens
If it did, it would break most apps, so no. —Jens
|
By
Jens Alfke
· #179
·
|
|
APFS & FileSystem attributes
It wouldn’t be a valid filesystem if it didn’t support the system calls like stat() that NSFileManager uses to get file attributes. Now, not every filesystem supports every attribute (you’re not going
It wouldn’t be a valid filesystem if it didn’t support the system calls like stat() that NSFileManager uses to get file attributes. Now, not every filesystem supports every attribute (you’re not going
|
By
Jens Alfke
· #181
·
|
|
Understanding NSNetService and peer-to-peer streaming
Right. You need to keep track of that yourself, like with a Peer class that can hold onto those streams and act as their delegate. NSNetService doesn't really have anything to do with those streams. A
Right. You need to keep track of that yourself, like with a Peer class that can hold onto those streams and act as their delegate. NSNetService doesn't really have anything to do with those streams. A
|
By
Jens Alfke
· #185
·
|
|
How to store C Arrays as a Property or iVar?
You can't assign (or compare) arrays in C/C++. You have two options: (a) Call memcpy: memcpy(&myArray, &_mArray, sizeof(myArray)); (b) Wrap a struct around the array, since structs are copyable. Drawb
You can't assign (or compare) arrays in C/C++. You have two options: (a) Call memcpy: memcpy(&myArray, &_mArray, sizeof(myArray)); (b) Wrap a struct around the array, since structs are copyable. Drawb
|
By
Jens Alfke
· #190
·
|
|
Understanding NSNetService and peer-to-peer streaming
This is a classic newbie networking mistake. (No offense I hope!) TCP is a stream, and there is absolutely no delimiter between writes, and no association between the number of bytes written vs. the n
This is a classic newbie networking mistake. (No offense I hope!) TCP is a stream, and there is absolutely no delimiter between writes, and no association between the number of bytes written vs. the n
|
By
Jens Alfke
· #199
·
|
|
How to store C Arrays as a Property or iVar?
(IIRC you suggested using an NSMutableArray of NSNumbers?) Honestly, it depends. It does have overhead, although not as much as it used to, since NSNumbers of reasonable-size integers don't allocate a
(IIRC you suggested using an NSMutableArray of NSNumbers?) Honestly, it depends. It does have overhead, although not as much as it used to, since NSNumbers of reasonable-size integers don't allocate a
|
By
Jens Alfke
· #203
·
|