返回

swiftui-如何将 TextField 拆分为字符?

发布时间:2022-05-19 13:47:25 285
# react-native

我想将输入到 TextField 中的单词放入一个数组中,但还将单词拆分为单独的字符,以便单词的每个字符都有其一个位置在数组中。

例如,如果有人在 TextField 中输入“猴子”,它将被放入这样的数组中

inputtedWord = ["m","o","n","k","e","y"]

This is what I have for the TextField:
@State private var normalText: String = ""

TextField("Input the word you want to be cipher.",
   text: $normalText)
   .padding(.all)
       Text("\(normalText)")
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(1)
按点赞数排序
用户头像