Re: [swift-users] What is the intended response to Array change notification for dependents?

2017-03-06 Thread Rien via swift-users
I don’t think there is a single answer to this. It is all highly dependant on what the application does with the info. Sometimes it will indeed be necessary to rebuild the entire gui, other times it is enough to simply insert a new table cell. Regards, Rien Site: http://balancingrock.nl Blog:

[swift-users] What is the intended response to Array change notification for dependents?

2017-03-06 Thread Edward Connell via swift-users
I would like to have an Array implementation where I get more information than just "the whole thing changed". As a value type I get it, but lets say it's a list of 500 image info structs and it's bound to UI. You change one item, now the whole array changes and you have to rebuild the entire

Re: [swift-users] Ugliness bridging Swift String to char *

2017-03-06 Thread Andrew Trick via swift-users
> On Mar 1, 2017, at 7:08 PM, Kenny Leung via swift-users > wrote: > > Hi Jordan. > > Thanks for the lengthy answer. > >> On Mar 1, 2017, at 6:21 PM, Jordan Rose > > wrote: >> >> Hey, Kenny. The const vs non-const

Re: [swift-users] Ugliness bridging Swift String to char *

2017-03-06 Thread Guillaume Lessard via swift-users
> On Mar 6, 2017, at 12:28 AM, Kenny Leung via swift-users > wrote: > > Follow-up on this: > > The StaticString solution doesn’t work: > > let separator: StaticString = “|” > opt.fieldSep = UnsafeMutablePointer(mutating: separator.utf8start) > > … because utf8start

Re: [swift-users] How to optionally link swift framework into another framework

2017-03-06 Thread Jakub Bednář via swift-users
C++ puts function pointers (or indexes into virtual function table) into the build binary so it looses track of what exactly it was build against. If in runtime you give it an object that has functions with different signature (types/number of parameters) or different semantics (it does

[swift-users] NSRegularExpression performance bug or bad code?

2017-03-06 Thread Francois Green via swift-users
Looking at the Benchmarks Game RegexDNA test, Swift's performance seems rather poor. Being new to Swift, I'm hoping someone can tell me if the problem is NSRegularExpression or is program just poorly written. http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna=swift=2

[swift-users] Swift/Obj C interoperability: 'Obj C only' functions

2017-03-06 Thread Andrew Hill2 via swift-users
Hi, I’ve been looking at making some changes to the ResearchKit library. This is mainly written in Objective C, with small portions of Swift. The Pull request I’ve generated leveraged Swift generics to make handling predicates easier from Swift. The existing functions had to utilise

Re: [swift-users] How to optionally link swift framework into another framework

2017-03-06 Thread Jonathan Prescott via swift-users
In most systems, including macOS, everyone uses the same linker, no matter what language. swiftc, at the object code level, supports the same ABI as clang(C/C++/Obj-C/Objc-C++), and in fact, uses a lot of the compiler infrastructure as clang, including pieces of clang. Your example is the

Re: [swift-users] How to optionally link swift framework into another framework

2017-03-06 Thread Rien via swift-users
The way I look at it is that Swift wants all symbols resolved when linking. C++ is probably very lenient toward full resolution, and as long as you know that a certain unresolved reference is not used, you can safely ignore the warning. Or maybe the C++ compiler is just very clever and can

Re: [swift-users] How to optionally link swift framework into another framework

2017-03-06 Thread Jonathan Prescott via swift-users
I think the process is the same as C/C++/Obj-C/Obj-C++, except it’s labelled differently for Swift. In Xcode, users set “C Pre-processor Macro Definitions” with things like USE_LOGGING. In Swift, since it doesn’t use the C pre-processor, Xcode has a separate build setting called “Active

Re: [swift-users] How to optionally link swift framework into another framework

2017-03-06 Thread Jakub Bednář via swift-users
Hi Rien, looks like a good way around my problem. Still I wonder why this does not work in Swift as it does work in Objective-C or even in strongly typed checked C++. Maybe it is some kind of Swift’s security measure to avoid hard-to-debug bugs in C++ caused by virtual table inconsistencies.

Re: [swift-users] How to optionally link swift framework into another framework

2017-03-06 Thread Rien via swift-users
Well, that was a bit short… When you want to use logging, define the ACC “USE_LOGGING” in the build settings. When you don’t want to use logging, don’t define the ACC. PS: You can get my logging framework from github: https://github.com/Balancingrock/SwifterLog Regards, Rien Site:

Re: [swift-users] How to optionally link swift framework into another framework

2017-03-06 Thread Rien via swift-users
You need conditional compilation. Called “Active Compilation Conditions” in the build settings. For example define a ACC of “USE_LOGGING” Then in your code: #if USE_LOGGING import Logging #else struct Logging { func debug(message: string) {} } #endif Regards, Rien Site:

Re: [swift-users] Proper Way to make Errors in Swift 3

2017-03-06 Thread Ronak via swift-users
Hi Ole, Yes that’s what I’m resorting to now. I had to change my Swift code to return NSError to all clients, regardless of language. Therefore, I really wonder why CustomNSError even exists. I could have just used NSError from the get go... Ronak > On Mar 5, 2017, at 2:20 PM, Ole Begemann

[swift-users] Swift error management - investigate what's behind

2017-03-06 Thread Jérôme Duquennoy via swift-users
Hi guys, I am right now building a presentation of the swift error management system for some of my colleagues. I can explain how it works from a dev’s standpoint, and how it interacts with obj-c. But I would like to have a deeper understanding of it, and notably to understand what the