Post

Replies

Boosts

Views

Activity

Set automatic rendering mode for custom SF Symbols
Hello, On iOS 16 and macOS Ventura SF Symbols now have a new automatic rendering mode. Often it equals to monochrome and sometimes to hierarchical. That's a great addition for sure. But how can one set the automatic rendering mode for their customs symbols ? I failed to find the answer in the documentation or the various WWDC sessions. Thank you !
0
0
1.1k
Sep ’22
Swift crashes during dealloc
I've made a little linked list, when there's to much nodes in it it crashes during dealloc. (reported: rdar://22189873)Here is a sample code :public class ListNode<T> { var next: ListNode<T>? weak var previous: ListNode<T>? let element: T init(element: T) { self.element = element } } public struct LinkedList<T> { public typealias Element = T private var head: ListNode<T>? private weak var tail: ListNode<T>? } public extension LinkedList { public mutating func append(element: Element) { let node = ListNode<T>(element: element) if head == nil || tail == nil { self.head = node self.tail = head } else { let old = tail tail = node old!.next = tail tail!.previous = old } } public mutating func removeAll() { head = nil } }That's pretty simple.Now here is a simple test :var count = 500_000 var ll = LinkedList<Int>() for i in 0..<count { ll.append(i) } ll.removeAll()It crashes. If count is lower than about 85000 it doesn't crash...I think it's because it releases nodes recursively once head is set to nil and causes function stack overflow.What shoul I do ?
2
0
4.5k
Aug ’15