Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

required keyword, initializers, and class inheritance
On page https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-ID231, a page on Initialization, at the section called Required Initializers, I find the following sentence:Write therequired modifier before the definition of a class initializer to indicate that every subclass of the class must implement that initializer:What does it mean to implement the initializer? Does that mean I have to explicitly write code for the inherited initializer, or could I consider the inherited initializers implemented without writing additional code in the subclass by virtue of inheritance? I thought initializers are automatically inherited by subclasses from the superclass by virtue of inheritance, without having to write explicit code for them in the subclass.
1
0
691
May ’16
Reply to required keyword, initializers, and class inheritance
You need to read the Language Guide more carefully.Firstly, there are conditions for automatic inheritance of an initializer. If the conditions are met a subclass inherits the initializer. If not it does not.Secondly, the Guide says clearly: You do not have to provide an explicit implementation of a required initializer if you can satisfy the requirement with an inherited initializer.So you need to implement the initializer if you cannot inherit an initializer from the superclass, or if the inherited initilizer would not do exactly what you want.Jan E.
Topic: Programming Languages SubTopic: Swift Tags:
May ’16
Reply to Can two SCNNodes with different textures share the same shader?
A node has a geometry, the geometry has materials and the materials have textures.If you want to change textures, you can either swap textures on the material (which will reflect on all models using the same material) or swap the material.From the Apple documentation:You can easily copy geometries and change their materials. A geometry object manages the association between immutable vertex data and a mutable assignment of materials. To make a geometry appear more than once in the same scene with a different set of materials, use its inherited copy method. The copy shares the underlying vertex data of the original, but can be assigned materials independently. You can thus make many copies of a geometry without incurring a significant cost to rendering performance.>>> This is similar to what happens in the SceneKit Editor in XCode when you hit the Unshare button (Sharing section of the Material inspector) to detach the material for the instance, in effect creating a copy of it.
Topic: Graphics & Games SubTopic: SceneKit Tags:
May ’16
override method in protocol extension
I'm doing a Cocoa app with bindings and so in every single NSViewController I have to write this code: override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) { guard context == &KVOContext else { super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context) return } var oldValue = change?[NSKeyValueChangeOldKey] if oldValue is NSNull { oldValue = nil } guard let undoManager = undoManager, object = object, keyPath = keyPath else { return } undoManager.prepareWithInvocationTarget(object).setValue(oldValue, forKeyPath: keyPath) }That's irritating. I wanted to fix it by creating an Undoable protocol, and then create a default implementation in an extension. But since this is an 'override' type method, that doesn't work. Short of creating an UndoableNSViewController that all my classes inherit from, are there other ways around this issue?
0
0
297
May ’16
Reply to hide property in object
I also tested that theory in code. I can still access a property declared as private from outside the object. Here is my test code which I put inside of a test class which conforms to the XCTestCase protocol. (Or it may be inheriting from the XCTestCase class. I can't tell.)func testAccessLevel() { class Dog { private var name = [Unnamed] private func bark() { print(Woof!) } } class Trainer { var dog = Dog() func tellDogToBark() { dog.bark() } } var dog1 = Dog() print(dog1.name) dog1.bark() var trainer = Trainer() trainer.tellDogToBark() }As you can see, the private property name on the instance of the Dog class can still be accessed from outside the instance.
Topic: Programming Languages SubTopic: Swift Tags:
May ’16
Reply to Tuple comparision
The problem with your definition is that the operator equivalences would not make sense. We want (a < b) == !(b <= a), so that exactly one of less, equal or greater describes the relationship between any two values.The existing definition makes sense if you think of the tuples as hierarchical from left to right. There's nothing necessary or even natural about that, but at least it's straighforward and consistent.
Topic: Programming Languages SubTopic: Swift Tags:
May ’16
Working with 3rd-Party Certificate Requests
I recently posed several questions to Apple Developer Support, but the response that I received was not very helpful.Perhaps someone in this forum can provide more useful insight. My query to Apple follows:QUESTION ONE: Is it proper to use a CSR issued by a third party to obtain development and distribution certificates from my own Apple Developer account?QUESTION TWO: If it is proper, what rights and privileges does the third party acquire, and what rights and privileges am I denied.QUESTION THREE: If it is not proper, what would you advise?BACKGROUND: Recently I purchased rights to the use of an online application use for creating commercial APPs for Android and iOS devices.After an unbelievably large number of software glitches for which I did eventually receive support I was ready to generate my newly created APP and upload it to the Apple Developer website. Having never initiated a request certificate on my own, or any other certificate for that matter, I was a little lost. After some independent investi
0
0
1.2k
May ’16
Reply to Testing File Data Protection
Does iExplorer is the right tool to test data protection?You have to be careful here. You typically run iExplorer on a Mac that’s already trusted by the device. That trust relationship is critical to supporting iTunes sync and backup, but it gives apps running on the Mac more capabilities than they would otherwise have.I’m not going to pretend I understand the details of this. Rather, I’ll point you at the iOS Security document, which covers it in some depth (in the Keybags section).Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.comWWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/
Topic: Privacy & Security SubTopic: General Tags:
Jun ’16
Certificates, Identifier &Profiles page
Hi, guysRecently, I try to login and reset my provision file, and I see an agreenment to submit, when I submit it, An unknown error occurred.THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE INC. (APPLE) STATING THE TERMS THAT GOVERN YOUR PARTICIPATION AS AN APPLE DEVELOPER. PLEASE READ THIS APPLE DEVELOPER AGREEMENT (“AGREEMENT”) BEFORE PRESSING THE AGREE BUTTON AND CHECKING THE BOX AT THE BOTTOM OF THIS PAGE. BY PRESSING AGREE, YOU ARE AGREEING TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, PRESS CANCEL.Apple Developer Agreement1. Relationship With Apple; Apple ID and Password. You understand and agree that by registering with Apple to become an Apple Developer (“Apple Developer”), no legal partnership or agency relationship is created between you and Apple. You agree not to represent otherwise. You also certify that you are at least thirteen years of age and you represent that you are legally permitted to register as an Apple Developer. This
1
0
413
Jun ’16
Reply to Process Cycle
Creating a payment in your case just means using PKPaymentRequest to start the payment flow. There is nothing fancy with your app need in terms of how it is implemented in Apple Pay. The Payment would get processed by a payment processor and this is where you need to start asking further questions about the possibilities. I would talk to your chosen processing company.https://developer.apple.com/library/ios/ApplePay_Guide/Configuration.htmIn setting up apple pay for your app YOU register for a Merchant ID. Transactions are between you and your customers. You should talk to the payment processor about your 3 party situation and how (or if) this will work the way you expect it to... meaning: can you facilitate payment to a 2nd party from a 3rd party especially if the people getting the money (2nd party) do not have a merchant relationship with the payment processor. Likely you can not. More likely you will need to accept the payment yourself via Apple Pay, and then do an additional backend server trans
Jun ’16
Reply to pthreads and Quality of Service Classes
I refer to the function the pthread was created with.OK.With that in mind, re-reading your original post it doesn’t sound like a QoS of QOS_CLASS_USER_INTERACTIVE is right here. That QoS is appropriate when the work is directly responsible for keeping the UI responsive. To quote <sys/qos.h>: A QOS class which indicates work performed by this threadSuch work is requested to run at high priority relative to other work on the system. Specifying this QOS class is a request to run with nearly all available system CPU and I/O bandwidth even under contention. This is not an energy-efficient QOS class to use for large tasks. The use of this QOS class should be limited to critical interaction with the user such as handling events on the main event loop, view drawing, animation, etc.Is that an accurate description of the relationship between this work and your UI?Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @appl
Jun ’16
Reply to SceneKit overlay (overlaySKScene) problem - 10.11.4?
It's been hard to diagnose this. There may be buggy software involved, but my resolution seems to have been hardware related. Two weeks ago my logic board was replaced [same failures after 12 hours of use], with no effect; last week it was replaced again and this time it may be OK [no failures after three days]. I can't be sure that there was a relationship between these hardware failures (kernel reporting unable to restart GPU) and the Sprite/SceneKit errors I was getting, but I suspect there was. My sample program that illustrated the failure now works.I learned long ago that my programming skills are not prefect, and that blaming the compiler or the hardware wasn't the solution; checking my code more carefully for edge effects, off-by-one errors, etc was always more fruitful. In this case, however, it was a hardware problem.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’16
Touch not responding outside UIView
Hello!I am new to this and there will probably exist a short and quick answer to this problem, to give a short overview:What I want: to increase the size of buttons on touch of the +-sign, then to highlight the correct button if the corresponding button is touched inside.So far: I have designed a custom class AddButton.swift inherited from UIControl, and inside that control I have added a few buttons AddButtonOption.swift (also custom class inherited from CALayer), everything works great so far and looks good on the screen.Problem :The problem strikes when I have resized the buttons, the touch only seem to respond inside the old UIView from before it has been resized (to a bigger size). I guess the problem lays in touch.locationInView(self)), but after many attempts I have to ask for advice.Code of interest:AddButton.swiftoverride func beginTrackingWithTouch(touch: UITouch, withEvent event: UIEvent?) -> Bool { ... let getBig = CATransform3DScale(button1Scale,resizeFactor, resizeFactor, 1.
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
397
Jun ’16
Reply to object changes after function call
My suspicion is that you've specified an inverse relationship that you're expecting the semantics for.If you have Pet's evolveTo and Evolution's evolveTo specified as inverse relationships, that should cause the behavior that you're seeing.
Replies
Boosts
Views
Activity
May ’16
required keyword, initializers, and class inheritance
On page https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-ID231, a page on Initialization, at the section called Required Initializers, I find the following sentence:Write therequired modifier before the definition of a class initializer to indicate that every subclass of the class must implement that initializer:What does it mean to implement the initializer? Does that mean I have to explicitly write code for the inherited initializer, or could I consider the inherited initializers implemented without writing additional code in the subclass by virtue of inheritance? I thought initializers are automatically inherited by subclasses from the superclass by virtue of inheritance, without having to write explicit code for them in the subclass.
Replies
1
Boosts
0
Views
691
Activity
May ’16
Reply to required keyword, initializers, and class inheritance
You need to read the Language Guide more carefully.Firstly, there are conditions for automatic inheritance of an initializer. If the conditions are met a subclass inherits the initializer. If not it does not.Secondly, the Guide says clearly: You do not have to provide an explicit implementation of a required initializer if you can satisfy the requirement with an inherited initializer.So you need to implement the initializer if you cannot inherit an initializer from the superclass, or if the inherited initilizer would not do exactly what you want.Jan E.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’16
Reply to (iOS Swift) How can I rebuild/reset Core Data?
Will be further testing - but right now it's working when handling a failed migration after changing a relationship from to-many to a to-one. My SO post as the updated solution.
Replies
Boosts
Views
Activity
May ’16
Reply to Can two SCNNodes with different textures share the same shader?
A node has a geometry, the geometry has materials and the materials have textures.If you want to change textures, you can either swap textures on the material (which will reflect on all models using the same material) or swap the material.From the Apple documentation:You can easily copy geometries and change their materials. A geometry object manages the association between immutable vertex data and a mutable assignment of materials. To make a geometry appear more than once in the same scene with a different set of materials, use its inherited copy method. The copy shares the underlying vertex data of the original, but can be assigned materials independently. You can thus make many copies of a geometry without incurring a significant cost to rendering performance.>>> This is similar to what happens in the SceneKit Editor in XCode when you hit the Unshare button (Sharing section of the Material inspector) to detach the material for the instance, in effect creating a copy of it.
Topic: Graphics & Games SubTopic: SceneKit Tags:
Replies
Boosts
Views
Activity
May ’16
override method in protocol extension
I'm doing a Cocoa app with bindings and so in every single NSViewController I have to write this code: override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) { guard context == &KVOContext else { super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context) return } var oldValue = change?[NSKeyValueChangeOldKey] if oldValue is NSNull { oldValue = nil } guard let undoManager = undoManager, object = object, keyPath = keyPath else { return } undoManager.prepareWithInvocationTarget(object).setValue(oldValue, forKeyPath: keyPath) }That's irritating. I wanted to fix it by creating an Undoable protocol, and then create a default implementation in an extension. But since this is an 'override' type method, that doesn't work. Short of creating an UndoableNSViewController that all my classes inherit from, are there other ways around this issue?
Replies
0
Boosts
0
Views
297
Activity
May ’16
Reply to hide property in object
I also tested that theory in code. I can still access a property declared as private from outside the object. Here is my test code which I put inside of a test class which conforms to the XCTestCase protocol. (Or it may be inheriting from the XCTestCase class. I can't tell.)func testAccessLevel() { class Dog { private var name = [Unnamed] private func bark() { print(Woof!) } } class Trainer { var dog = Dog() func tellDogToBark() { dog.bark() } } var dog1 = Dog() print(dog1.name) dog1.bark() var trainer = Trainer() trainer.tellDogToBark() }As you can see, the private property name on the instance of the Dog class can still be accessed from outside the instance.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’16
Reply to Tuple comparision
The problem with your definition is that the operator equivalences would not make sense. We want (a < b) == !(b <= a), so that exactly one of less, equal or greater describes the relationship between any two values.The existing definition makes sense if you think of the tuples as hierarchical from left to right. There's nothing necessary or even natural about that, but at least it's straighforward and consistent.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’16
Working with 3rd-Party Certificate Requests
I recently posed several questions to Apple Developer Support, but the response that I received was not very helpful.Perhaps someone in this forum can provide more useful insight. My query to Apple follows:QUESTION ONE: Is it proper to use a CSR issued by a third party to obtain development and distribution certificates from my own Apple Developer account?QUESTION TWO: If it is proper, what rights and privileges does the third party acquire, and what rights and privileges am I denied.QUESTION THREE: If it is not proper, what would you advise?BACKGROUND: Recently I purchased rights to the use of an online application use for creating commercial APPs for Android and iOS devices.After an unbelievably large number of software glitches for which I did eventually receive support I was ready to generate my newly created APP and upload it to the Apple Developer website. Having never initiated a request certificate on my own, or any other certificate for that matter, I was a little lost. After some independent investi
Replies
0
Boosts
0
Views
1.2k
Activity
May ’16
Reply to Testing File Data Protection
Does iExplorer is the right tool to test data protection?You have to be careful here. You typically run iExplorer on a Mac that’s already trusted by the device. That trust relationship is critical to supporting iTunes sync and backup, but it gives apps running on the Mac more capabilities than they would otherwise have.I’m not going to pretend I understand the details of this. Rather, I’ll point you at the iOS Security document, which covers it in some depth (in the Keybags section).Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.comWWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’16
Certificates, Identifier &Profiles page
Hi, guysRecently, I try to login and reset my provision file, and I see an agreenment to submit, when I submit it, An unknown error occurred.THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE INC. (APPLE) STATING THE TERMS THAT GOVERN YOUR PARTICIPATION AS AN APPLE DEVELOPER. PLEASE READ THIS APPLE DEVELOPER AGREEMENT (“AGREEMENT”) BEFORE PRESSING THE AGREE BUTTON AND CHECKING THE BOX AT THE BOTTOM OF THIS PAGE. BY PRESSING AGREE, YOU ARE AGREEING TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, PRESS CANCEL.Apple Developer Agreement1. Relationship With Apple; Apple ID and Password. You understand and agree that by registering with Apple to become an Apple Developer (“Apple Developer”), no legal partnership or agency relationship is created between you and Apple. You agree not to represent otherwise. You also certify that you are at least thirteen years of age and you represent that you are legally permitted to register as an Apple Developer. This
Replies
1
Boosts
0
Views
413
Activity
Jun ’16
Reply to Process Cycle
Creating a payment in your case just means using PKPaymentRequest to start the payment flow. There is nothing fancy with your app need in terms of how it is implemented in Apple Pay. The Payment would get processed by a payment processor and this is where you need to start asking further questions about the possibilities. I would talk to your chosen processing company.https://developer.apple.com/library/ios/ApplePay_Guide/Configuration.htmIn setting up apple pay for your app YOU register for a Merchant ID. Transactions are between you and your customers. You should talk to the payment processor about your 3 party situation and how (or if) this will work the way you expect it to... meaning: can you facilitate payment to a 2nd party from a 3rd party especially if the people getting the money (2nd party) do not have a merchant relationship with the payment processor. Likely you can not. More likely you will need to accept the payment yourself via Apple Pay, and then do an additional backend server trans
Replies
Boosts
Views
Activity
Jun ’16
Reply to pthreads and Quality of Service Classes
I refer to the function the pthread was created with.OK.With that in mind, re-reading your original post it doesn’t sound like a QoS of QOS_CLASS_USER_INTERACTIVE is right here. That QoS is appropriate when the work is directly responsible for keeping the UI responsive. To quote <sys/qos.h>: A QOS class which indicates work performed by this threadSuch work is requested to run at high priority relative to other work on the system. Specifying this QOS class is a request to run with nearly all available system CPU and I/O bandwidth even under contention. This is not an energy-efficient QOS class to use for large tasks. The use of this QOS class should be limited to critical interaction with the user such as handling events on the main event loop, view drawing, animation, etc.Is that an accurate description of the relationship between this work and your UI?Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @appl
Replies
Boosts
Views
Activity
Jun ’16
Reply to SceneKit overlay (overlaySKScene) problem - 10.11.4?
It's been hard to diagnose this. There may be buggy software involved, but my resolution seems to have been hardware related. Two weeks ago my logic board was replaced [same failures after 12 hours of use], with no effect; last week it was replaced again and this time it may be OK [no failures after three days]. I can't be sure that there was a relationship between these hardware failures (kernel reporting unable to restart GPU) and the Sprite/SceneKit errors I was getting, but I suspect there was. My sample program that illustrated the failure now works.I learned long ago that my programming skills are not prefect, and that blaming the compiler or the hardware wasn't the solution; checking my code more carefully for edge effects, off-by-one errors, etc was always more fruitful. In this case, however, it was a hardware problem.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’16
Touch not responding outside UIView
Hello!I am new to this and there will probably exist a short and quick answer to this problem, to give a short overview:What I want: to increase the size of buttons on touch of the +-sign, then to highlight the correct button if the corresponding button is touched inside.So far: I have designed a custom class AddButton.swift inherited from UIControl, and inside that control I have added a few buttons AddButtonOption.swift (also custom class inherited from CALayer), everything works great so far and looks good on the screen.Problem :The problem strikes when I have resized the buttons, the touch only seem to respond inside the old UIView from before it has been resized (to a bigger size). I guess the problem lays in touch.locationInView(self)), but after many attempts I have to ask for advice.Code of interest:AddButton.swiftoverride func beginTrackingWithTouch(touch: UITouch, withEvent event: UIEvent?) -> Bool { ... let getBig = CATransform3DScale(button1Scale,resizeFactor, resizeFactor, 1.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
1
Boosts
0
Views
397
Activity
Jun ’16