User Defined RunTime Attributes Set a Color - swift

I have a package from GitHub with custom UITextFields and in the User Defined Run Time Attributes there is a field borderActiveColor with a custom color. Is there anyway I can add in my own color in the code?

I don't believe that the attribute borderActiveColor is not a standard iOS attribute. Is the project in question using the following custom text field control by any chance?
https://github.com/hdoria/HDNTextField
If so, all you need to do is use that UITextField subclass in your project as well and then set the borderActiveColor property in your code for the subclassed text fields.

Related

How to build Insert Remove Form with Xcode Object Library for Cocoa Swift?

Rocket for Mac has a Preferences Window in which it has a form like below to insert & remove an app.
I want to make a form like that but how should I build it? I am new to Cocoa development so this might be obvious.
I want to make the one with the label Disable Rocket within these apps:
I found a solution.
What I did was use NSTableView with single column for the textbox. And made the NSTextField in it to be text editable using the Behaviour attribute.
Then for the + & - button I used 2 NSPopupButton & made the Image attribute to be NSAddTemplate & NSRemoveTemplate which exists by default in Xcode. There are bunch of other images that are default in it.
That solved it for me :)

Asset Catalog named colors are not available to #IBInspectable properties

For my iPad app that I'm creating, I have an Asset Catalog in my project containing several color sets. I know that I can drag and drop these into the code itself and have done so for the default color of an #IBInspectable class property. However, when I go to use these in Interface Builder, my color sets are available to properties like a UIView's background color, but they're not available to any #IBInspectable property that allows users to set a color. Is there any way to expose my color sets to my #IBInspectable class to where they're selectable in Interface Builder? Sure, I can always set these programmatically, but for future use and convenience's sake, I'd like to get this working if Apple currently supports it. My Colors Asset Catalog is definitely added to my project's Bundle Resources in my Build Settings if that information is relevant.
Screenshots of my issue:
This first image shows where my color sets are selectable for properties like a UIView's background. The next two show where they're not available to my #IBInspectable properties.
I've found temporary solution till the Xcode resolve this issue.
Please use Recently Used Colors, and if you choose the one that is in your assets (in recent onces) it will automatically change it to the defined one. Works for me :)

Two Frameworks use the name for a property

SwifterSwift has a property name cornerRadius.
It's an extension to UIView.
While the DropDown framework has a property name cornerRadius.
DropDown (the class) is a subclass of UIView.
It seems like xCode doesn't know which property I'm referring to.
I only imported one framework to my file but SwifterSwift's extension still takes effect.
I modified the DropDown framework and everything worked fine but then I reverted because it's not allowed and I wouldn't know how to debug any future problems.
I also tried creating a function in an extension to somehow get around this problem.
It turns out that I can't directly access DropDown's table (which is the view that we round).
I cant remove the SwifterSwift framework because it has already been used in the project that I'm working on. Although that might be the best option.
Is there a solution to this problem ?
In Swift, namespaces are implicit and belong to target it is defined. So, for your case, the workaround would be to add the target name in the property call.
SwifterSwift.cornerRadius
DropDown.cornerRadius
Let take example of String. It belongs to Swift target and so I can do this
let str = Swift.String("abc".characters)
Please follow the steps in this issue
Or upvote for adding prefix to all SwifterSwift extensions here

Mac OS X global tint color like iOS

Is there any possible way to set global tint color in OS X. If I want to set brand color on Cocoa control like NSTabView. How cloud I do it?
if you need to change it in your app
class NSAppearance : NSObject, NSCoding Description An NSAppearance
object represents a file that specifies a standard appearance that
applies to a subset of UI elements in an app. An app can contain
multiple appearance files and—because NSAppearance conforms to
NSCoding—you can use Interface Builder to assign UI elements to an
appearance.
We needed to do this for an application that wanted to have a very-similar appearance between the Windows and Mac OS X versions (don't judge me - it's what the customers want). What we ended up doing is more-or-less:
Create an NSDictionary of brand-approved colors, indexed by what the color is used for (*text colors, background colors, button colors, etc).
Add a "user-defined runtime attribute" in the InterfaceBuilder inspector, telling each view which colors to use.
Write a category on NSView (and a few other Appkit views) that implements a setter for that attribute, which then calls -setBackgroundColor: or whatever other AppKit API you need to change the default colors.
Since -setBackgroundColor: is only available on views that have a Core Animation layer, we ended up adding code to our NSView property setter to call -setWantsLayer:YES on every view which needed a non-default background color.
Another approach is to create an "Appearance file", which you can load to override the visual appearance of AppKit controls. This is not a very well documented process, but see this related StackOverflow question/answer for details.
How can I make an "appearance file" for NSAppearance?

Howto add validation in listview in sugarcrm7?

I need to add validation for field:Phone to prevent adding text into phone field in SugarCRM 7.5
is it possible?
Thanks
You can achieve this functionality by different solutions:
Include JQuery Mask plugin and apply validation on all phone type fields.
Create custom field type for phone and apply validation.
Sugar has provided field validation for record view you can also get help from it link.
Here is related link to your question
Thanks Saad,
I did it by following solution:
Create a new custom field
Add my own mask input into _render() and initialize function
I added keypress event into custom field controller to prevent press invalid characters (symbols,....)
I added mustache files to showing proper values in edit,list view,...