[swift-users] Helping the type checker
I have recently used the "-warn-long-function-bodies" flag, and have luckily only one place in my code where I should give the compiler a better hint. At Swift 4 it looks a bit different, but I prefer to wait before I make any unnecessary changes. The code is as follows: subscript(path: IndexPath) -> ViewModel.SubField { get { return ViewModel.connectors[path[0]][path[1]].connector.subFields[path[2]][path[3]] } set { ViewModel.connectors[path[0]][path[1]].subFields[path[2]][path[3]] = newValue } } I made it: subscript(path: IndexPath) -> ViewModel.SubField { get { let connector = ViewModel.connectors[path[0]][path[1]] return connector.subFields[path[2]][path[3]] } set { ViewModel.connectors[path[0]][path[1]].subFields[path[2]][path[3]] = newValue } } And the warning for the get disappears, but I do not know what to do with set part. The 1.4 seconds it takes, now bother me where I know it. For a better understanding, the types look like this. enum ViewModel { struct Connector { var subFields: [[SubField]] = [] } static var connectors: [[ViewModel.Connector]] = [] struct SubField: Hashable {} } Has anyone a solution for me? Regards, Daniel ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users
Re: [swift-users] QualityOfService for concurrentPerform in Swift 3
I do not understand why this works, but when you create a queue in the line before. It will be used. Like in this example: let queue = DispatchQueue.global(qos: .default) DispatchQueue.concurrentPerform(iterations: n) > Hmm, I didn’t realize that concurrentPerform doesn’t allow you to pass in > your own queue…this looks like an oversight to me. Maybe someone with more > experience with libdispatch could explain? > > Saagar Jha > > > > > On Sep 25, 2016, at 09:13, Gerriet M. > > Denkmannmailto:g...@mdenkmann.de)>wrote: > > > > > On 25 Sep 2016, at 23:08, Saagar > > > Jhamailto:saa...@saagarjha.com)>wrote: > > > > > > You might be looking for the DispatchQoS.QoSClass enum. > > > > > > Saagar Jha > > > > Probably. But how to make concurrentPerform use any of these enums? > > > > Gerriet. > > > > > > > > > > > > > On Sep 25, 2016, at 05:19, Gerriet M. Denkmann via > > > > swift-usersmailto:swift-users@swift.org)>wrote: > > > > > > > > In ObjC: > > > > > > > > dispatch_queue_t queue = dispatch_get_global_queue( > > > > DISPATCH_QUEUE_PRIORITY_HIGH, 0 ); > > > > dispatch_apply( nbrThreads, queue, ^void(size_t idx) … > > > > > > > > In Swift 3: > > > > DispatchQueue.concurrentPerform( iterations: nbrThreads) … > > > > > > > > How can one specify the DISPATCH_QUEUE_PRIORITY or QualityOfService to > > > > be used by concurrentPerform? > > > > > > > > Gerriet. > > > > > > > > ___ > > > > swift-users mailing list > > > > swift-users@swift.org(mailto:swift-users@swift.org) > > > > https://lists.swift.org/mailman/listinfo/swift-users > > > > > > > > ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users
[swift-users] SwiftPackage with Swift and C Targets and external dependency
I created a Package which include Swift and C code, plus dependency to another swift package. The package builds without problems with DEVELOPMENT-SNAPSHOT-2016-05-31-a. But it doesn’t build with 3.0-PREVIEW-2. I get the following error: fatal error: ClangModule ClangModule(SOLPOS) can't have SwiftModule(Strand) as a dependency.: … When I move the C code in extra Package, it builds again. But I would like to know if this behaviour is intended or a bug of spm. You can find the project here: https://github.com/damuellen/SwiftSolar ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users