Post

Replies

Boosts

Views

Activity

Reply to Google Drive & XCode Projects
Would it help to do the following? Option1 Every student creates an alias on their Mac pointing to the path of the text files In the C++ code you refer to this alias Option 2 If the Google drive path is consistent, then you could even use ~ in place of home folder and the rest of the Google drive path. That way all C++ code files could have the same path
Jul ’21
Reply to LazyVGrid inside ScrollView not pinning section header
See if this meets your expectations Changes: The outer most is a horizontal scroll view Inside that you have a vertical scroll view Move the other content inside the vertical scroll view var body: some View { ScrollView(.horizontal) { ScrollView(.vertical) { Text("Other content") .frame(maxWidth: .infinity, minHeight: 100) .background(Color.yellow) LazyVGrid( columns: Array(repeating: GridItem(.fixed(200), spacing: 0, alignment: .center), count: 9), spacing: 16, pinnedViews: [.sectionHeaders] ) { Section(header: header) { ForEach(1..<500) { Text("Cell #\($0)") } } } Text("Other content") .frame(maxWidth: .infinity, minHeight: 100) .background(Color.yellow) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to How to change thread or reference of NotificationCenter's handler when observing value change
Not sure if this would help, a simpler solution would be to use a timer struct ContentView: View { @StateObject var model = Model() var body: some View { VStack { Button(!model.isStarted ? "Start" : "Stop") { model.toggle() } Text(String(model.counter)) } } } class Model: ObservableObject { @Published var counter = 0 @Published var isStarted = false private var timer: Timer? func toggle() { if isStarted { stop() } else { start() } } private func start() { timer = makeTimer() isStarted = true } private func stop() { timer?.invalidate() isStarted = false } private func makeTimer() -> Timer { Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] timer in self?.counter += 1 } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Async/let producing error in playground? Xcode 13.0 beta
@eskimo Feedback I have file a feedback FB9546874 Versions: The issue happens with Xcode Playground (iOS) Xcode: Version 13.0 beta 5 (13A5212g) macOS: 11.5.2 (20G95) Note: The same code runs fine in a SwiftUI project Code: import UIKit func f1() async -> Int { return 10 } Task { async let a = f1() async let b = f1() let c = await a + b print("c = \(c)") } Error: error: AsyncLet.playground:8:15: error: expression is 'async' but is not marked with 'await' async let a = f1() ^ await error: AsyncLet.playground:9:15: error: expression is 'async' but is not marked with 'await' async let b = f1() ^ await
Aug ’21
Reply to installing Monterey in separate APFS volume?
Note: Profile installation has to be done on the current volume Profile installation Download macOS beta profile from the developer portal Install the beta profile on your existing volume (this can’t be installed on the new volume) Download macOS Beta System Preferences > Software Update now will show the macOS beta Tap on Upgrade now Downloading of the macOS beta will start Create a separate Volume https://support.apple.com/en-us/HT208891 Open Disk Utility Select Macintosh HD (top most item) Add a new volume (no need to allocate any space) Remove Profile from existing volume This is required so that macOS beta updates don’t appear on your current volume, otherwise might end up accidentally updating to macOS beta on your current volume https://beta.apple.com/sp/betaprogram/unenroll Open System Preferences > Software Update Click Details > Restore Defaults Installing macOS Beta The macOS Beta installer would ask for the location / volume Tap on show all disks to make all volumes visible Select the volume you newly created Install
Topic: Community SubTopic: Apple Developers Tags:
Oct ’21
Reply to How do I use async/await with NotificationCenter?
func observeNotifications() async { //Use any notification name appropriate     let customNotificationName = Notification.Name("custom")     let notifications = NotificationCenter.default.notifications(named: customNotificationName,                                                                  object: nil) //If you want to receive only notifications from a specific sender then specify that in object     //notifications is an AsyncSequence     //Each iteration in the loop would run asynchronously as when new notification is added to the sequence     for await notification in notifications {         print(notification)     } }
Topic: Community SubTopic: Apple Developers Tags:
Nov ’21
Reply to NSSecureCoding allowed classes list
@eskimo I am facing the same issue while working with Share Extensions. Adding a share extension on a blank new project and running it throws the same warning: Info.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> <integer>1</integer> </dict> </dict> <key>NSExtensionMainStoryboard</key> <string>MainInterface</string> <key>NSExtensionPointIdentifier</key> <string>com.apple.share-services</string> </dict> </dict> </plist> Warning [Foundation] *** -[NSXPCDecoder validateAllowedClass:forKey:]: NSSecureCoding allowed classes list contains [NSObject class], which bypasses security by allowing any Objective-C class to be implicitly decoded. Consider reducing the scope of allowed classes during decoding by listing only the classes you expect to decode, or a more specific base class than NSObject. This will become an error in the future. Allowed class list: {( "'NSObject' (0x7fff862bc6e8) [/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib]" )}
Nov ’21
Reply to Xcode 13.2 - Internal error : Missing Package Description Module
Swift Packages - Problem AppStore Version has a problem when used on projects that use Swift packages, It throws the error Internal error: missingPackageDescriptionModule Workaround Download Xcode 13.2 (13C90) from https://developer.apple.com/download/release/ which seems to work ok Note: In case you download from Developer portal and delete the old Xcode, you might need to add the Git and Apple accounts. Otherwise you wouldn't be able to add packages / re-fetch packages
Dec ’21