Post

Replies

Boosts

Views

Activity

Determine which SIM is used to access the Internet
Initially, my task was to determine which type of connection is being used at the moment: 5G or 4G. And I found "CTTelephonyNetworkInfo().serviceCurrentRadioAccessTechnology" but there is a problem when the device has more than one sim. My iPhone has two sims, one physical and one electronic. I need to determine which one is used to access the network. I tried to use "CTTelephonyNetworkInfo().serviceCurrentRadioAccessTechnology" but it is a dictionary [String: String] that only indicates the connection of each of the cards, and it is not possible to find out which one is active from this dictionary. So how can I determine which of the two cards are currently being used to access the Internet?
3
0
662
May ’24
Error when I try to instantiate @Model
I'm trying to instantiate my model and I'm getting an error on the set first property import Foundation import SwiftData @Model final class PointModel { var x: CGFloat var y: CGFloat init( x: CGFloat, y: CGFloat ) { self.x = x self.y = y } } extension PointModel { static var preview: PointModel { PointModel(x: 0, y: 0) } } let point = PointModel(x: location.x, y: location.y) { get { _$observationRegistrar.access(self, keyPath: \.x) return self.getValue(for: \.x) } set { _$observationRegistrar.withMutation(of: self, keyPath: \.x) { self.setValue(for: \.x, to: newValue) **Thread 1: Fatal error: Illegal attempt to use a nil as an Attribute - x + 151.0** } } } Has anyone else experienced this problem? Maybe someone knows how to solve this?
2
0
1.1k
Jun ’23