Hi All,
After long hours trying to find appropriate answer on google and other website, I have decided to post the question here where APPLE developer could help.
How to remove this issues as it's not appearing on simulator only but on real device too.
I have two simple UItextfield, programatically ask for a num.pad and I get the following error :
Can't find keyplane that supports type 11 for keyboard iPhone-PortraitTruffle-NumberPad; using 25764PortraitTruffleiPhone-Simple-Pad_Default
Post
Replies
Boosts
Views
Activity
I 'm. struggling with the following code "import SwiftUI
struct ContentView: View {
var pictures = [String]()
var body: some View {
let fm = FileManager.default
let path = Bundle.main.resourcePath!
let items = try! fm.contentsOfDirectory(atPath: path)
for item in items {
if let item = item.hasPrefix("nssl") {
pictures.append(item)
}
}
print(pictures)
}
}
while before it was :
class ViewController: UIViewController {
var pictures = [String] "()
override func viewDidLoad() {
super.viewDidLoad()
let fm = FileManager.default
let path = Bundle.main.resourcePath!
let items = try! fm.contentsOfDirectory(atPath: path)
and it was working
Hi Team,
I would like to Crete a line code that would help me to take whatever image in my ***** in Xcode and what ever the size of the image I would like this image to be resize to fit in a circle
Hi Team, I would like to combine or mix and match two filter
here is the code but seems like I cannot do what I want...
I want to be able to show only what the filter is made for so if TECO and favorite is active then I would only see favourite and not TECO project , and if TECO is not active but favourite is active then it will only show all favourite project and if TECO is active it will only show all project which are not TECO regardless if they are favortie
import SwiftUI
struct ProjectList: View {
@State private var showTecoOnly = false
@State private var showFavoriteOnly = false
var filteredTECOProjects: [Project] {
projects.filter { project in
(!showTecoOnly || !project.isTeco)
}
}
var filteredProjects: [Project] {
projects.filter { project in
(!showFavoriteOnly || project.isFavorite)
}
}
var body: some View {
NavigationSplitView {
List {
Toggle(isOn: $showTecoOnly) {
Text("Hide TECO")
}
Toggle(isOn: $showFavoriteOnly) {
Text("Show Favorite")
}
ForEach (filteredTECOProjects ) && ForEach (filteredProjects ) { project in
NavigationLink {
ProjectDetail(project: project)
} label: {
ProjectRow(project: project)
}
}
Divider()
}
.animation(.default, value: filteredTECOProjects)
.navigationTitle("PROJECTS")
} detail: {
Text("Select a project")
}
}
}
#Preview {
ProjectList()
}
hi everyone does anyone understand this issues below ? What to do or change in my code when this appear my code is over more than 20 swift file I don't know which one to share lol
dyld[1060]: Symbol not found: _$s21DeveloperToolsSupport17UVPreviewRegistryCMn
Referenced from: /private/var/containers/Bundle/Application/ACD0F0D4-CAF4-4101-BFC0-3990E29F316E/MyPmV1.app/MyPmV1
Expected in: /System/Library/Frameworks/DeveloperToolsSupport.framework/DeveloperToolsSupport
Hi All,
if anyone is keen to help me build this interface
i would like to build it in 4 swift file
1- Logictimekeyin : this will be the model data of 8h per day time calculation
2-TimekeyinRow this will represent one row
3-ListOfchoice this will be a combination of the project
4-timekeyinView it will be the list of choice a divider and other non project waisted time during the day + the setting around the view including the logic to calculate the total time ;)
have fun helping me , I believe I will finish my project within this week , if anyone wanna help and see which will be the best code will deserve a solving and thumb up
happy development guys
hi all, I'm writing to DevForum after few days of struggle 13-15h everyday trying to dig many forum for solution ( try Github for: do to list and many other app built in to switch between toggle and button to see if the issues was coming from here
My App idea seems simple actually very complex to build for me, I have manage to build the solution for one row and it's working but when it goes to adding the row into a list I'm giving up....
I do not understand why in my TimeKeyInRow structure it's working I can clic and get feedback of every single hours but when I add row to a list even if I have already created an ID it's still taking the all row as one isSet
import SwiftUI
struct HourButton: View,Identifiable {
var id: String = "hour"
@State var isSet: Bool
var value: Double = 1
var body: some View {
HStack {
Button {
isSet.toggle()
print("clic already \(isSet) \(id)h & \(value) has Value")
} label: {
Label("8h", systemImage: isSet ? "circle.fill" : "circle")
.labelStyle(.iconOnly)
.foregroundStyle(isSet ? .blue : .gray)
}.id(id)
}
}
}
struct HourButton_Previews: PreviewProvider {
static var previews: some View {
//#Preview {
HourButton(id: "MORN", isSet: true, value: 3)
}
}
This is the Row Part which is working fine
import SwiftUI
struct TimeKeyInRow: View,Identifiable {
var id: String
var project: Project
@Binding var isSet: Bool
let listOfPossibleHours: [Double] = [0.5,1,2,3,4,8]
var body: some View {
HStack {
Text(project.shortname)
Spacer()
HourButton(id: "\(project.shortname)\(0)", isSet: true, value: listOfPossibleHours[0])
HourButton(id: "\(project.shortname)\(1)", isSet: true, value: listOfPossibleHours[1])
HourButton(id: "\(project.shortname)\(2)", isSet: true, value: listOfPossibleHours[2])
HourButton(id: "\(project.shortname)\(3)", isSet: true, value: listOfPossibleHours[3])
HourButton(id: "\(project.shortname)\(4)", isSet: true, value: listOfPossibleHours[4])
Text("\(project.leftPMtime)")
}
}
}
struct TimeKeyInRow_Previews: PreviewProvider {
static var previews: some View {
//#Preview {
let projects = ModelData().projects
TimeKeyInRow(id: "test", project: projects[2], isSet: .constant(true))
}
}
Then the part were the issues is coming
import SwiftUI
struct TimeKeyinList: View, Identifiable{
var id: String
@Environment(ModelData.self) var modelData
let projects = ModelData().projects
@State var isSet: Bool
@State private var hideTeco = false
var filteredProjects: [Project] {
// removeTECO project
modelData.projects.filter { project in
!project.isTeco
}}
var body: some View {
VStack {
HStack {
Text("TIME KEY_IN")
.font(.title)
.multilineTextAlignment(.leading)
.bold()
Spacer()
Text("8h")
.font(.title)
.multilineTextAlignment(.leading)
.bold()
}.padding()
List {
HStack(alignment: .top) {
Text("Project Name")
.frame(width: 80, height: 25)
.font(.caption)
.multilineTextAlignment(.center)
.lineLimit(8)
.allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/)
.multilineTextAlignment(.center)
.bold()
Spacer(minLength:30)
Text("0.5h")
.font(.footnote)
Text("1h")
.font(.footnote)
.padding(/*@START_MENU_TOKEN@*/EdgeInsets()/*@END_MENU_TOKEN@*/)
Text("2h")
.font(.footnote)
.padding(/*@START_MENU_TOKEN@*/EdgeInsets()/*@END_MENU_TOKEN@*/)
Text("3h")
.font(.footnote)
.padding(/*@START_MENU_TOKEN@*/EdgeInsets()/*@END_MENU_TOKEN@*/)
Text("4h")
.font(.footnote)
.padding(/*@START_MENU_TOKEN@*/EdgeInsets()/*@END_MENU_TOKEN@*/)
Text("Time Left")
.frame(width: 60, height: 25)
.font(.caption)
.multilineTextAlignment(.center)
.lineLimit(8)
.allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/)
.multilineTextAlignment(.center)
.bold()
}
ForEach (filteredProjects) { project in
TimeKeyInRow(id: project.shortname, project: project, isSet: $isSet)
}
Divider()
// TimeKeyInRow(project: "TRAINING", isSet: $isSet)
// TimeKeyInRow(isSet: $isSet, projectshortname: "MEETING", timeleft: 0)
// TimeKeyInRow(isSet: $isSet, projectshortname: "NON ALLOCATED", timeleft:0)
// TimeKeyInRow(isSet: $isSet, projectshortname: "HOLIDAY", timeleft:0)
//
// }
// .listStyle(.inset)
// DatePicker(selection: /*@START_MENU_TOKEN@*/.constant(Date())/*@END_MENU_TOKEN@*/, label: { /*@START_MENU_TOKEN@*/Text("Date")/*@END_MENU_TOKEN@*/ })
}.labelsHidden()
}
}
}
struct TimeKeyinList_Previews: PreviewProvider {
static var previews: some View {
//#Preview {
TimeKeyinList(id: "test", isSet: true).environment(ModelData())
}
}
Hi DevForum team, I'm struggling with some code around designing with proper frame size for Text which give issues with different iPhone size,
below full code working perfectly on iPhone 15-14, but not iPhone 14Pro & Xr crash happen ( when I try to understand the crash ... try lol , read between lines) it's all about frame and size so I believe it's about the phone size and the pixel taken from the .frame of the Text
one more weird thing happen when I look at the code I share below directly thru preview of TimekeyinList the rendering is very nice,
but when I look at it from the contentViewtab View I get this ****** finish any idea why ?
import SwiftUI
struct TimeKeyinList: View {
@Environment(ModelData.self) var modelData
let projects = ModelData().projects
@State var isSet: [Bool] = [false, false, false, false, false,false,false,false]
var filteredNonTECOProjects: [Project] {
// removeTECO project
modelData.projects.filter { project in
!project.isTeco
}}
var body: some View {
VStack {
HStack {
Text("TIME KEY_IN")
.font(.title)
.multilineTextAlignment(.leading)
.bold()
Spacer()
Text("8h")
.font(.title)
.multilineTextAlignment(.leading)
.bold()
}.padding()
Spacer()
VStack(spacing: 5){
HStack(alignment: .top) {
Text(" Project Name")
.multilineTextAlignment(.leading)
.lineLimit(2)
.frame(width: 120.0) // <<-- To get proper alignment
Text(".5h")
Text("1h")
Text("2h")
Text("3h")
Text("4h")
Text("8h")
Text("Time Left")
.multilineTextAlignment(.trailing)
.lineLimit(2)
.frame(width: 50)
}
VStack(spacing: 20) {
BlankKeyInRow()
ForEach(Array(filteredNonTECOProjects.enumerated()), id: \.offset) { (row, project) in
if project .isSpecific {
BlankKeyInRow()
BlankKeyInRow()
TimeKeyInRow(id: project.shortname, project: project, isSet: $isSet[row])
} else {
TimeKeyInRow(id: project.shortname, project: project, isSet: $isSet[row])
}
}
}
.listStyle(.inset)
DatePicker(selection: /*@START_MENU_TOKEN@*/.constant(Date())/*@END_MENU_TOKEN@*/, label: { /*@START_MENU_TOKEN@*/Text("Date")/*@END_MENU_TOKEN@*/ })
}
.environment(\.sizeCategory, .extraExtraExtraLarge)
.labelsHidden()
Spacer()
.onAppear() {
// <<-- Added
for (row, project) in filteredNonTECOProjects.enumerated() {
isSet[row] = !project.isTeco
}
}
Spacer()
}
}
}
struct TimeKeyinList_Previews2: PreviewProvider {
static var previews: some View {
//#Preview
TimeKeyinList().environment(ModelData())
}
}
second file
import SwiftUI
struct TimeKeyInRow: View,Identifiable {
var id: String
var project: Project
@Binding var isSet: Bool
let listOfPossibleHours: [Double] = [0.5,1,2,3,4,8]
var body: some View {
HStack {
Text(project.shortname.paddedToWidth(10)) // Text(projects[1].shortname)
.font(.custom("Menlo", size: 16))
.frame(width: 120.0) // <<-- To get proper alignment
Spacer()
ForEach(listOfPossibleHours, id: \.self) { hour in
HourButton(id: "\(project.shortname)", isSet: isSet, value: hour)
}
Text("\(project.leftPMtime)")
.font(.custom("Menlo", size: 16))
.multilineTextAlignment(.leading)
.frame(width: 45) // <<-- To get proper alignment
}
}
}
struct TimeKeyInRow_Previews: PreviewProvider {
static var previews: some View {
//#Preview {
let projects = ModelData().projects
TimeKeyInRow(id: "test", project: projects[2], isSet: .constant(true))
}
}
extension String { // To align text
func paddedToWidth(_ width: Int) -> String {
let length = self.count
guard length < width else {
return self
}
let spaces = Array<Character>.init(repeating: " ", count: width - length)
return self + spaces
}
}
struct BlankKeyInRow: View {
var body: some View {
HStack {
Text("") // Text(projects[1].shortname)
}
}
}
and the starting button point
import SwiftUI
struct HourButton: View,Identifiable {
var id: String = "hour"
@State var isSet: Bool
var value: Double
var body: some View {
HStack {
Button {
isSet.toggle()
print("clic on Project : \(id) an turn to : \(isSet) for \(value)h")
if isSet == true {
print("true is \(isSet)")
} else {
print("false is\(isSet)")
}
} label: {
Label("8h", systemImage: isSet ? "circle.fill" : "circle")
.labelStyle(.iconOnly)
.foregroundStyle(isSet ? .blue : .gray)
}.id(id)
}
}
}
struct HourButton_Previews: PreviewProvider {
static var previews: some View {
//#Preview {
HourButton(id: "MORN", isSet: true, value: 3)
}
}
Hi DevForum team, I'm struggling with the logic to create behind my nice code:
as you can see in my ButtonHour (last page) I have
if isSet == true {
print("true is \(isSet)")
} else {
print("false is\(isSet)")
}
the things is that I cannot place anything in between this lines beside Print( ) which is useless for me,
Target was for me to be able to Bind & @state this with the following logic & the swift file I want to link it with
@Observable
class TimesheetCalculation {
let maxHourPerDay: Double = 8
var hourchoosen: Double = 0
var totalhourbooked: Double = 0
var remainingHour: Double = 8
var cvsrecordedtrackingcodek: String = "id,value,shortprojectName,day"
func checkRemainingHours() -> Double {
return remainingHour
}
````` // Logic to create, every single button has an ID and a value
//first is to collect all the clicked button and make sure he cannot clic more than 8 hours
//but first it to link the variable in TimesheetCalculation class, which is not working so far
//once I manage to connect this the following logic will apply
//maxHourPerDay = 8h
//hourchoosen = value of clic button
//totalhourbooked = value + value + value - value (if click false)
//remainingHour = maxHourPerDay - totalhourbooked
//cvsrecordedtrackingcodek will be to keep track of previous day, converted in cvs for future excel export
//checkRemainingHours function to automaticly calcuation each time the button has been clic , normlay once the logic will be set I will just put this checkRemainingHours into the action button .
// the is also anothe logic that I need to put in place.
//if remainingHour - new Value being click is less than 0 then the button will not be able to toggle, meaning that he will not be able to key-more than 8h `````
}
struct TimeKeyinList: View {
@Environment(ModelData.self) var modelData
let projects = ModelData().projects
@State var isSet: [Bool] = [false, false, false, false, false,false,false,false]
var filteredNonTECOProjects: [Project] {
// removeTECO project
modelData.projects.filter { project in
!project.isTeco
}}
var body: some View {
VStack {
HStack {
Text("TIME KEY_IN")
Spacer()
Text("8h")
}
Spacer()
VStack(spacing: 5){
HStack(alignment: .top) {
Text(" Project Name")
.multilineTextAlignment(.leading)
.lineLimit(2)
.frame(width: 120.0) // <<-- To get proper alignment
Text(".5h")
Text("1h")
Text("2h")
Text("3h")
Text("4h")
Text("8h")
Text("Time Left")
}
VStack(spacing: 20) {
BlankKeyInRow()
ForEach(Array(filteredNonTECOProjects.enumerated()), id: \.offset) { (row, project) in
if project .isSpecific {
BlankKeyInRow()
BlankKeyInRow()
TimeKeyInRow(id: project.shortname, project: project, isSet: $isSet[row])
} else {
TimeKeyInRow(id: project.shortname, project: project, isSet: $isSet[row])
}
}
} .listStyle(.inset)
DatePicker(selection: /*@START_MENU_TOKEN@*/.constant(Date())/*@END_MENU_TOKEN@*/, label: { /*@START_MENU_TOKEN@*/Text("Date")/*@END_MENU_TOKEN@*/ })
}.environment(\.sizeCategory, .extraExtraExtraLarge)
.labelsHidden()
Spacer()
.onAppear() {
// <<-- Added
for (row, project) in filteredNonTECOProjects.enumerated() {
isSet[row] = !project.isTeco
}
}
Spacer()
}
}
}
struct TimeKeyinList_Previews2: PreviewProvider {
static var previews: some View {
TimeKeyinList().environment(ModelData())
}
}
second file
struct TimeKeyInRow: View,Identifiable {
var id: String
var project: Project
@Binding var isSet: Bool
let listOfPossibleHours: [Double] = [0.5,1,2,3,4,8]
var body: some View {
HStack {
Text(project.shortname.paddedToWidth(10)) // Text(projects[1].shortname)
.font(.custom("Menlo", size: 16))
.frame(width: 120.0) // <<-- To get proper alignment
Spacer()
ForEach(listOfPossibleHours, id: \.self) { hour in
HourButton(id: "\(project.shortname)", isSet: isSet, value: hour)
}
Text("\(project.leftPMtime)")
}
}
}
struct TimeKeyInRow_Previews: PreviewProvider {
static var previews: some View {
let projects = ModelData().projects
TimeKeyInRow(id: "test", project: projects[2], isSet: .constant(true))
}
}
extension String { // To align text
func paddedToWidth(_ width: Int) -> String {
let length = self.count
guard length < width else {
return self
}
let spaces = Array<Character>.init(repeating: " ", count: width - length)
return self + spaces
}
}
struct BlankKeyInRow: View {
var body: some View {
HStack {
Text("") // Text(projects[1].shortname)
}
}
}
and the starting button point
import SwiftUI
struct HourButton: View,Identifiable {
var id: String = "hour"
@State var isSet: Bool
var value: Double
var body: some View {
HStack {
Button {
isSet.toggle()
print("clic on Project : \(id) an turn to : \(isSet) for \(value)h")
if isSet == true {
print("true is \(isSet)")
} else {
print("false is\(isSet)")
} } label: {
Label("8h", systemImage: isSet ? "circle.fill" : "circle")
.labelStyle(.iconOnly)
.foregroundStyle(isSet ? .blue : .gray)
}.id(id)
}
}
}
struct HourButton_Previews: PreviewProvider {
static var previews: some View {
//#Preview {
HourButton(id: "MORN", isSet: true, value: 3)
}
}
Hi all, could you please explain extreme detail what this code is doing exactly, because it's working on my APP but not very certain of this Tupple
ForEach(Array(filteredNonTECOProjects.enumerated()), id: \.offset) { (row, project) in
TimeKeyInRow(id: project.id, project: project, isSet: $isSet[row])
when.I look at the documentation of swift is seems like I'm using the TUPPLE within another tupple... I I'm lost hahahaha
Since I included comment in my code I will send few post with all relevant detail
here are my question for this SWfit file
you place the projects = Modeldata().projectswhile I was trying to do it under modelData.swift file because when I add it into Project.swift file it's not Parse since not in my JSON. should I also add into the JSON ?
to make the code cleaner I use a SetTimeKeyInView that I will share in next post
creation of date and date range for my new datepickrange buttons
@State var isSet: [Bool] = [false, false, false, false, false,false,false,false] is not needed
@State private var hideTeco = false is not needed I have also remove it isTECO means Technically close project meaning I don't need to work on it but keep them as reference if one day I want to go and see location, customer and other info
remove and change name for more clarity on code and like to point 2 I don't use it in here anymore
Datepicker I will dedicate another threat POST as manyquestion I'm facing
as you can see I don;t use the code
.onAppear() {
// <<-- Added
for (row, project) in filteredNonTECOProjects.enumerated() {
isSet[row] = !project.isTeco
}
}
so I'm not sure what is the code doing and I don't see the link with isTeco
import SwiftUI
struct TimeKeyinList: View, Observable {
@Environment(ModelData.self) var modelData
@Environment(TimesheetCalculation.self) var timesheetCalculation
//MARK: - Variable & Constants
// let projects = ModelData().projects // Now need a State var to be able to modify later I did not do that need to check with Claude
var listofpossibleHourstext = TimesheetCalculation().listOfPossibleHoursText
@State var isSet = ModelData().isSet // I think the code from claude is what I'm trying to do here
// @State var projects = [Project] () //CLAUDEADD Now need a State var to be able to modify
@State var date = TimesheetCalculation().date
@State var dateRange = TimesheetCalculation().dateRange
// @State var isSet: [Bool] = [false, false, false, false, false,false,false,false] // explain to claude that I I ahve more proejct in future and I don't increare this list then the app crash ... not very sure why but i believe it's due to the number of row link with the number of project dispaly
//CLAUDE SAY Not the correct var to keep hours for each project. @State var isSet: [Bool] = [true, false, false, true]
//Alreadydeleted @State private var hideTeco = false // What's the purpose of this ? Not used in code
// I remove the on appear as the code don't need it
//@State var filteredProjects: [Project] = []
/* { Init will be done in onAppear
// removeTECO project
projects.filter { project in
!project.isTeco
}
}*/
//MARK: - Body
var body: some View {
@Bindable var timesheetCalculation = timesheetCalculation
VStack {
HStack {
Text("TIME KEY_IN")
.font(.title)
.multilineTextAlignment(.leading)
.bold()
Spacer()
Button {
print(TimesheetCalculation().date)
} label: {
Label("SAVE", systemImage: "square.and.arrow.down")
.foregroundStyle(.blue )
.scaleEffect(1.2)
}
Spacer()
//findtheocde to remove intRemaining hours keep the full string into a flooting point and tronacte teh string to only 3character
let IntremainingHour = Int(timesheetCalculation.remainingHour)
Text("\(IntremainingHour)h")
.font(.title)
.multilineTextAlignment(.leading)
.bold()
}.padding()
Spacer()
VStack(spacing: 5){
HStack(alignment: .top) {
Text(" Project Name")
.multilineTextAlignment(.center)
.lineLimit(2)
.frame(width: 120.0) // <<-- To get proper alignment
//use the TimekeyinRow listofPossibleHour
ForEach((listofpossibleHourstext),id: \.self) { hour in
Text("\(hour)h")
}
Text("Time Left")
.multilineTextAlignment(.trailing)
.lineLimit(2)
.frame(width: 50)
}.environment(\.sizeCategory, .extraExtraExtraLarge)
SetTimeKeyInView()
}
HStack {
DatePickerStyle().environment(\.sizeCategory, .extraExtraExtraLarge)
Button {
//I need to clean the cache for
//clean all button
// remove all of date cvs
//remaining hour = 8
$timesheetCalculation.remainingHour
} label: {
Label("CLEAN", systemImage: "arrow.up.trash")
.labelStyle(.iconOnly)
.foregroundStyle(.blue )
.scaleEffect(1.2)
}
}
Spacer()
// .onAppear() {
// // <<-- Added
// for (row, project) in filteredNonTECOProjects.enumerated() {
// isSet[row] = !project.isTeco
// }
// }
let _ = print(modelData.isSet)
Spacer()
}
}
}
struct TimeKeyinList_Previews2: PreviewProvider {
static var previews: some View {
//#Preview
TimeKeyinList()
.environment(ModelData())
.environment(TimesheetCalculation())
}
}
Hi Team,
sounds simple but maybe there is a better way than what I’m doing today.
issues : I‘m tired of messing up my project when doing to much modification and can’t make it work again because of to much change in the same time.
temporary fix: save the full xcode folder into a new project
question:: is there a more professional way to keep change a project structur, code, line, func , or whatever but having all the modifications highlighted . something similar to GIT but without git ?
https://www.swift.org/getting-started/swiftui/
This training page let you understand the Vstack purpose but if you look at my own way of doing it I Made it disappear ??? is this a new release from Swift ?
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Why not try…")
.font(.largeTitle.bold())
Spacer()
Circle()
.fill(.blue)
.padding()
.overlay(
Image(systemName: "figure.archery")
.font(.system(size: 144))
.foregroundColor(.white)
)
Text("Archery!")
.font(.title)
Spacer()
}
}
#Preview {
ContentView()
}