Post

Replies

Boosts

Views

Activity

Reply to What’s the difference between a Blank and an Xcode Playground?
I cannot find any documentation about this. It's a pity many of the templates do not contain enough documentations. As far as I tried, the template Xcode Playground will create a file package with extension .playground, which is compatible with Xcode Playground. On the other hand, the template Blank creates a file package of .playgroundbook, which is compatible with Swift Playgrounds for iPad and Swift Playgrounds for Mac. This is the common behavior as in most other templates. You may already know but Xcode Playground is a part of Xcode, Apple's official tool to develop apps for Apple's platforms. So, if you want to make something which needs to be compatible with Xcode, you should choose the template Xcode Playground. But, as there's Swift Playgrounds for Mac, you would rarely need the template Xcode Playground. By the way, you should better respond to the answers (or comments, possibly) you get. Many readers prefer to write answers to the questions of which the authors respond properly.
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’21
Reply to Axie infinity
NO, you cannot get such a thing here. The dev forums is not a place to request sort of invitation code of some specific app. Contact to the author of the app directly.
Nov ’21
Reply to ScrollView overlapping NavigationView bar
Thanks for updating. I (and possibly some other readers) will take some time to investigate. ... Sorry, but your code generates error Cannot find 'fruit' in scope and there may be more errors -- the definitions of FruitHeaderView or SourceLinkView are missing. Also you are not showing the root view (shown as < Fruits). Hard to find what's happening under the currently shown info.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to An alternative Swift method to PHP `pack()` method
This is what I would write if I were given the PHP class Tag in your link: import Foundation public class MyTag { public let tag: UInt8 public let value: String public init(tag: UInt8, value: String) { self.tag = tag assert(value.utf8.count < 256, "The length of `value` needs to be less than 256.") self.value = value } public var length: Int { value.utf8.count } ///Use this instead of `__toString()`. ///Please remember, in PHP, `__toString()` may be called implicitly in many cases. ///You may need to replace all such cases to use this `getData()` explicitly. public func getData() -> Data { return toByteData(tag) + toByteData(UInt8(length)) + value.data(using: .utf8)! } ///Use this instead of `toHex()`. func toByteData(_ value: UInt8) -> Data { return Data([value]) } } Generally, it is hard to convert code of some language having a concept of binary string into Swift. You may have two ways: Use String and consider how you embed binary data into String. Use Data and when you need to concatenate it with String, convert the String to Data before concatenating. I would choose the latter. let myTag = MyTag(tag: 1, value: "abc") print(myTag.toByteData(1).base64EncodedString()) //-> AQ==
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’21
Reply to Axie Infinity
The dev forum is not a place for notification of release dates of some specific app. Find the site of the developer of the app.
Nov ’21
Reply to JSONDecoder().decode failing on struct containing array(s)
Can you show the definitions of all the structs related?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Update tableView in swift 5
When you show your code, you should use the Code Block feature, not images. With showing easily readable code in easily reusable way, more readers would to try to solve your issue.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Import Image from SwiftUI even if project already declares an internal Image type
No way. All the declarations in your app project always precede imported declarations. You can move your own declaration of Image into subproject, of course that may force you to rewrite many parts of your project. Generally, declaring too generic names like Image would not be recommended.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to What’s the difference between a Blank and an Xcode Playground?
I cannot find any documentation about this. It's a pity many of the templates do not contain enough documentations. As far as I tried, the template Xcode Playground will create a file package with extension .playground, which is compatible with Xcode Playground. On the other hand, the template Blank creates a file package of .playgroundbook, which is compatible with Swift Playgrounds for iPad and Swift Playgrounds for Mac. This is the common behavior as in most other templates. You may already know but Xcode Playground is a part of Xcode, Apple's official tool to develop apps for Apple's platforms. So, if you want to make something which needs to be compatible with Xcode, you should choose the template Xcode Playground. But, as there's Swift Playgrounds for Mac, you would rarely need the template Xcode Playground. By the way, you should better respond to the answers (or comments, possibly) you get. Many readers prefer to write answers to the questions of which the authors respond properly.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to ScrollView overlapping NavigationView bar
When you show your code, you should better show your code as text using Code Block. With easily testable code given, more readers would try to find what's happening and how you can fix it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Axie infinity
NO, you cannot get such a thing here. The dev forums is not a place to request sort of invitation code of some specific app. Contact to the author of the app directly.
Replies
Boosts
Views
Activity
Nov ’21
Reply to ScrollView overlapping NavigationView bar
Thanks for updating. I (and possibly some other readers) will take some time to investigate. ... Sorry, but your code generates error Cannot find 'fruit' in scope and there may be more errors -- the definitions of FruitHeaderView or SourceLinkView are missing. Also you are not showing the root view (shown as < Fruits). Hard to find what's happening under the currently shown info.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to An alternative Swift method to PHP `pack()` method
This is what I would write if I were given the PHP class Tag in your link: import Foundation public class MyTag { public let tag: UInt8 public let value: String public init(tag: UInt8, value: String) { self.tag = tag assert(value.utf8.count < 256, "The length of `value` needs to be less than 256.") self.value = value } public var length: Int { value.utf8.count } ///Use this instead of `__toString()`. ///Please remember, in PHP, `__toString()` may be called implicitly in many cases. ///You may need to replace all such cases to use this `getData()` explicitly. public func getData() -> Data { return toByteData(tag) + toByteData(UInt8(length)) + value.data(using: .utf8)! } ///Use this instead of `toHex()`. func toByteData(_ value: UInt8) -> Data { return Data([value]) } } Generally, it is hard to convert code of some language having a concept of binary string into Swift. You may have two ways: Use String and consider how you embed binary data into String. Use Data and when you need to concatenate it with String, convert the String to Data before concatenating. I would choose the latter. let myTag = MyTag(tag: 1, value: "abc") print(myTag.toByteData(1).base64EncodedString()) //-> AQ==
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to [iOS15 only] When the value of @published changes, the View returns to the parent View
Can you show enough code to test what's happening? row, BaseRowView, Test, bleDeviceList, TABleManager and ManagerDelegate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Filtering a NSTreeController / NSOutlineView
Can you show enough code to reproduce the issue?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Changing title of button also changes font and size.
Can you show enough code to reproduce the issue?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to ScrollView overlapping NavigationView bar
There might be someone who would not hesitate to dive into some external links. Better wait for such reader would find this thread. Good luck.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Filtering a NSTreeController / NSOutlineView
Seems you do not like to make your question more appealing to readers.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Getting started with creating swift playground
Are you working with Swift Playgrounds (an app for iPadOS and macOS)? Or Xcode Playground (a part of Xcode)?
Replies
Boosts
Views
Activity
Nov ’21
Reply to Axie Infinity
The dev forum is not a place for notification of release dates of some specific app. Find the site of the developer of the app.
Replies
Boosts
Views
Activity
Nov ’21