Quick one line question about Plugin interface

Talk to other Pedia users about the programs, share tricks and tips or ask questions about existing features.
Post Reply
LibertyTrooper
Captain
Captain
Posts: 21
Joined: Tue Nov 07, 2017 11:22 am

Quick one line question about Plugin interface

Post by LibertyTrooper »

Is there a reason that resultURLs is not scoped the same as resultTitles and that neither of them are accessible via properties?
User avatar
Conor
Top Dog
Posts: 5337
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Quick one line question about Plugin interface

Post by Conor »

Properties did not exist at the time of writing. They are new and exciting, as of like 8 years ago. :D

resultTitles gets used by the drawer to display all the results available, while the other is only ever used inside the class.
LibertyTrooper
Captain
Captain
Posts: 21
Joined: Tue Nov 07, 2017 11:22 am

Re: Quick one line question about Plugin interface

Post by LibertyTrooper »

Hi,

I saw that. Is there some reason that its more appropriate in that class rather than being part of interface declaration in Sample.h? I have to say, while I"m able to write Objective-C, by no means am I an expert.
User avatar
Conor
Top Dog
Posts: 5337
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Quick one line question about Plugin interface

Post by Conor »

MyPediaPlugin class does a lot of the boiler plate loading and does access both variables in a few places for clean up. For example if the HTTP connection fails it sets them both to empty arrays, it also initializes them for you as mutable arrays. But you could move that work in to Sample plugin and not rely on what the superclass does.

This is actually something that needs to get refactored, as in Swift the conventions are different and even the initializing of a class is more strict and in a specific order. For example in Swift you have to initialize all your variables before you even call super.init on the super class and then initialize variables that are inherited, plus make sure to always call the designated initializer (you can't go through a convenience method). It's all a bit stricter, but intros sense it's better. As it's clear what is going on to someone debugging and issues.
LibertyTrooper
Captain
Captain
Posts: 21
Joined: Tue Nov 07, 2017 11:22 am

Re: Quick one line question about Plugin interface

Post by LibertyTrooper »

Well, the methods are being called so thats a very good start. I think where the problems are in my code are in the delegate accessors. The source level debugger sucks so I've not figured out *why* the errors are occurring yet. Swift really cannot make up its mind about setDelegate.

I took a break yesterday and played a bit more with the Python version. I've come to love that language except for list comprehensions and the dain bramaged lambda. But as Guido says, Python isn't a functional language.

By the way, I came across an excellent tool for munging data. I'm kicking myself since its been around since 2011 yet I was completely unaware. Its called OpenRefine and its by Google. Not sure how often you run into a need to munge data, but it could be useful if you ever want to do change to data, for example, in doghouse. Though, maybe it doesn't apply in that case. What I mean to say is that it allows for making data consistent and it does it in a very methodical way.
Post Reply