Posts

Post not yet marked as solved
8 Replies
- It is a macOS app. Any macOS app- Storyboard- Many times it fails from the beginning without any code. Now I am testing adding small code in class ViewController: NSViewController- In Storyboard I see a Window Controller and a View Controller Scene- The Window Controller Attributes > Is initial Controller is checked and I see the initial arrow- Size Inspector, I have checked the position of the window
Post marked as solved
6 Replies
Thank you Claude. I know how to do that in iOS. I am asking only for macOS.I do not know how to apply your suggestions. For instance, var hasVerticalScroller: Bool
Post marked as solved
4 Replies
I tried that but it gives the warning: Fixed width constraints may cause clipping
Post marked as solved
8 Replies
Sorry, but I still do not understand.Let's say that I create a new project:The first window is ViewController.swiftI put a second View Controller from library. I connect that with SecondViewController.swiftI have button1 in ViewController.swift with segue1 that goes to SecondViewController.swiftI suppose the next step is, if I understand what you say, go to Main.storyboard control drag from SecondViewController to ViewController.swift and create an Oulet. Is that right? But if I amb in storyboard SecondViewController and I open the assistant, it will open the SecondViewController.swift not ViewController.swift. How and where do you make that connection of the window?
Post marked as solved
8 Replies
I suppose I do not have the necessary level. There are many things I do not understand in your code.Just to begin: if I put the var it gives me an error: "Class 'ViewController' has no initializers"Where should that var be? do you do anything before?class ViewController: NSViewController { var myWindow: NSWindow}
Post marked as solved
8 Replies
I do not understand your code. I am totally lost. Can you explain where do you put each part? What steps do you take?
Post marked as solved
2 Replies
Post marked as solved
4 Replies
Thank you for the reference to the videos. I will love to study that.func updateData() is a simple code to create data in Core Data that I found in a tutorial. There is no error there, it is ok. What I miss in that code is a way to check if the value I want to update exists in Core Data.For instance, the example is looking for John. If it finds it, it will change it to John2. But, if in the database there is no John, that will not work, of course. So, I need to add something like the conditional that I put at the beginning. My question is how can I say in that example "if (you find the username John in Core Data) ..."
Post not yet marked as solved
11 Replies
Thank you for your helpI do not understand your (1) I suppose that I use the Default Configurations if I do nothing. Is that right? Or should I do something to activate it?Thank your so much!Narcís
Post not yet marked as solved
11 Replies
After trying many things I could find where the problem is. Things go wrong when I change the Type of the Attribute in the .xcdatamodeld The only solution I could find is to create a new project.I cannot even create a new Attribute with a different name. It seems that, I cannot change any Attribute in the .xcdatamodeld. Am I missing anything?
Post not yet marked as solved
11 Replies
Thank you for your answer.This line of code gives me error:contingut.setValue(Date(), forKey: "dateCreated")I tried to keep the datamodel Attribute Type to String and then change to Date. In both cases, it gives me an errorThen I tried:contingut.setValue("\(Date())", forKey: "dateCreated")In this case, it creates well the date but only if the Type is StringI am confused, what is the right way to do that?
Post not yet marked as solved
11 Replies
Thank you for your answer. I have updated my question. I think that corrects some errors in my previous code and answers your questions. In the end, I want to know how to insert the date when the information is entered.
Post not yet marked as solved
11 Replies
- What is the problem:When I click the button insert I get an error:Thread 1: signal SIGABRTIn the console:2020-03-02 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "data"; desired type = NSDate; given type = __NSCFString; value = (Function).' libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)The problem is in this line of code:contingut.setValue("\(today2)", forKey: "data")If I remove the previous line of code and I only use this, it works well. Here I insert the text from the UITextView:contingut.setValue(textForm.text, forKey: "text1")- What do you expect? I just want to safe the date when the user enter the text in a form (UITextView)
Post marked as solved
6 Replies
Yes, read works well. Thank you.Now I am working on this.
Post marked as solved
6 Replies
I think I understand the tutorial. That information is useful. Thank you. But I do not know how to apply that to the way to do things in the Insert that I show in the question. If I understand, in that case, they put the context outside the crud, they do not do that in each crud. Only once at the beginning.For instance how to:- Read: how to call the context (lazy var context) and then read all the pairs name - password that the database has.- Update: how to call the context and then update the password for the name John (for instance)- Delete: how to call the context and delete the name John and its password