Post

Replies

Boosts

Views

Activity

Reply to Using protocol functions at unknown class
Maybe just make a function that will give the instance from name? I would use a Dictionary, if the number is 50 or so. let stringToNeededMethods: [String: NeededMethods] = [ "FirstImplementation": FirstImplementation(), //... ] if let theInstance = stringToNeededMethods["FirstImplementation"] { print(theInstance.doSmt(str: "0123")) }
Topic: App & System Services SubTopic: General Tags:
Dec ’21
Reply to How to use SF Symbols 3
Are you writing a code for iOS? SF Symbols are included in iOS, so you just need to check the availability of the symbol you want to use, and then specify the name of it in your app. No need to add something to Asset Catalog.
Topic: Design SubTopic: General Tags:
Dec ’21
Reply to How do I fill in CXProviderDelegate in SwiftUI?
As you found, you cannot make a view type (which is a struct!) conform to CXProviderDelegate. You need to create a class inheriting NSObject and make it conform to CXProviderDelegate and use it in your view. By the way, in Swift, type names should start with Capital letters. You should not use videoTabView as a View name.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21
Reply to POD Compatibility
Whether or not they are using pods, apps and libraries may need fixes when new versions of iOS/iOS SDK are released. Unfortunately, many of the pods are very late about this sort of fixes. (Or old ones might be frozen.) If updating the versions of the pods to the latest does not solve your issue, you may need to contact to the author of the pods.
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’21
Reply to Cannot use instance member 'model' within property initializer; property initializers run before 'self' is available
As the error message is clearly stating, you cannot use any instance members within property initializer (= Observer(model?.head)). One way to work around this restriction would be moving initialization into init(). class SampleViewModel { var model: SampleModel? let changeData: Observer<String> init() { let model = SampleModel() self.model = model self.changeData = Observer(model.head) } func changeLabel(_ tf: String) { self.changeData.value = tf } } You will not see the error with this change, but I'm not sure this would work as you expect.
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’21
Reply to dateFormater returns nil on Specific date
I could have found a few timezones where date(from:) returns nil for "1991-03-24T00:00:00". For example, Asia/Jerusalem. I'm not sure what would be the reason for this specific case, but historically, some ranges of local date & time may be missing from the calendar system of some regions. You may need to find a better way to represent a date using Date for such regions.
Dec ’21
Reply to Using protocol functions at unknown class
Maybe just make a function that will give the instance from name? I would use a Dictionary, if the number is 50 or so. let stringToNeededMethods: [String: NeededMethods] = [ "FirstImplementation": FirstImplementation(), //... ] if let theInstance = stringToNeededMethods["FirstImplementation"] { print(theInstance.doSmt(str: "0123")) }
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to How to use SF Symbols 3
Are you writing a code for iOS? SF Symbols are included in iOS, so you just need to check the availability of the symbol you want to use, and then specify the name of it in your app. No need to add something to Asset Catalog.
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to How do I fill in CXProviderDelegate in SwiftUI?
As you found, you cannot make a view type (which is a struct!) conform to CXProviderDelegate. You need to create a class inheriting NSObject and make it conform to CXProviderDelegate and use it in your view. By the way, in Swift, type names should start with Capital letters. You should not use videoTabView as a View name.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to POD Compatibility
Whether or not they are using pods, apps and libraries may need fixes when new versions of iOS/iOS SDK are released. Unfortunately, many of the pods are very late about this sort of fixes. (Or old ones might be frozen.) If updating the versions of the pods to the latest does not solve your issue, you may need to contact to the author of the pods.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Cannot use instance member 'model' within property initializer; property initializers run before 'self' is available
As the error message is clearly stating, you cannot use any instance members within property initializer (= Observer(model?.head)). One way to work around this restriction would be moving initialization into init(). class SampleViewModel { var model: SampleModel? let changeData: Observer<String> init() { let model = SampleModel() self.model = model self.changeData = Observer(model.head) } func changeLabel(_ tf: String) { self.changeData.value = tf } } You will not see the error with this change, but I'm not sure this would work as you expect.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to dateFormater returns nil on Specific date
I could have found a few timezones where date(from:) returns nil for "1991-03-24T00:00:00". For example, Asia/Jerusalem. I'm not sure what would be the reason for this specific case, but historically, some ranges of local date & time may be missing from the calendar system of some regions. You may need to find a better way to represent a date using Date for such regions.
Replies
Boosts
Views
Activity
Dec ’21
Reply to XCode reporting issues twice
I am experiencing the same issue just now. Have you already sent a bug report?
Replies
Boosts
Views
Activity
Dec ’21
Reply to Contacts Framework CNFetchResult
@ShinehahGnolaum, you should better show the original code and your code which represents what you have done till now. With some concrete code shown, more readers would try to solve it.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to UIDevice.current.orientation returns 0 when iPad is attached to external keyboard
Whether or not it would be an intended behavior, you can send a feedback if the current behavior does not fit for your app.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Is cocopod MMChatFramework still supported
Apple has never stated any of the pods as supported. You may need to contact to the author of the pod.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Publishig Failed
Can you be more specific? Please explain what you have done, what you have get and what you expect.
Replies
Boosts
Views
Activity
Dec ’21
Reply to NavigationLink issue
Can you share your code by showing it as text, not as image?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Is cocopod MMChatFramework still supported
@snafupatton, Seems you may need to find a better place to ask for good frameworks. The dev forums is for discussing about app development for Apple's platform using Apple's frameworks and Apple's tools. Many questions asking for third party frameworks had not gotten good responses here.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Contacts Framework CNFetchResult
As the editing feature of this site is very limited, you may need to use Your Answer to add an additional info.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Make app available only for iPhone only not ipads
So for now we want to make our app available for iPhones only. Is there any way to do that? > NO. If you make your app for targeting iPhone only, your app needs to run on the simulator mode (3.5' screen) of iPad. Fix your app to run on iPad or make it target for both iPhone and iPad. The only other alternative is abandoning to publish it on the App Store.
Replies
Boosts
Views
Activity
Dec ’21