131 questions
6
votes
2
answers
2k
views
Xcode 16 @IBInspectable properties not showing in the xib file
After updating to the latest version of the Xcode IBInspectable properties not showing up in the xib editor. You can see in the screenshots below that inspectable properties added both as extension ...
-1
votes
1
answer
92
views
IBInspectable stored property in extension
I would like all subclasses of UIView to have a stored property IBInspectable. Unfortunately I can't use an extension of UIView, because in an extension, an IBInspectable cannot be a stored property.
...
0
votes
2
answers
627
views
@IBDesignable preview in IB again broken under XCode 14.2 on M2?
I receive the error:
.../Base.lproj/MainMenu.xib Failed to render instance of : dlopen(....app, 0x0001): tried: '/...' (no such file), '....app' (mach-o file, but is an incompatible architecture (...
0
votes
1
answer
1k
views
Failed to render and update auto layout
I am using Xcode 13.4.1 in Rosseta mode on Macbook Pro (M1 chip) running macOS Monterey v12.0.
Basically, IBDesignable views are not getting updated in XIB and throwing weird errors.
All the details ...
0
votes
1
answer
764
views
UIImage not resizing according to UIImageView size width and height
I am a Swift newbie and I am trying to add an UIImageView on the right of UITextField using Storyboard and @IBInspectable annotation.
However, when I define my UIImageView with specific size and add ...
1
vote
1
answer
123
views
IBDesignable custom NSControl class - frame not resizing in Interface Builder
This is for macOS, not iOS ... thank you.
I have a very simple custom slider control that has 2 @IBInspectable properties - trackHeight and knobHeight. I want my control's frame in Interface Builder ...
0
votes
0
answers
66
views
how to correctly calculate corneRadius of a XIB in swift
cannot set calculated value for the roundedCorners of this xib. only works if Hard coded. So do you have solution? and more generally speaking, is this a good way to make a xib?
this works, but is ...
2
votes
0
answers
1k
views
Set UIView Border Color or width in swift using @IBInspectable
@IBDesignable extension UIView {
@IBInspectable var borderColor: UIColor? {
set {
layer.borderColor = newValue?.cgColor
}
get {
guard let color = ...
1
vote
1
answer
246
views
Create max character length in UITextField using IBInspectable [duplicate]
I want to create a max length to my textfield with IBInspectable, I see a answer to this on a question here but I'm getting an error saying Expression type '()' is ambiguous without more context,
My ...
1
vote
1
answer
1k
views
Trouble with IBInspectable and loading a view from xib for Interface Builder
I have a custom class with its own .xib. I'm trying to incorporate IBInspectable to change the color of its background and subviews' backgrounds in IB.
In IB, when I leave 'Custom Class' blank, and ...
1
vote
1
answer
597
views
Remove @IBInspectable error: Failed to set () user defined inspected property on (UIView)
I added an @IBInspectable property named style as an extension to UIView. I refactored it because it interferes with UITableView.style. I am getting this error, I know exactly what the error means, ...
1
vote
0
answers
374
views
Xcode Storyboard Fail to show (render) ViewControllers (The agent crashed)
I'm running Xcode Version 10.2.1 (10E1001) on MacBook Pro 2016
Processor: 2.6 GHz Intel Core i7
Memory: 16 GB 2133 MHz LPDDR3
Graphic: Radeon Pro 450 2 GB and Intel HD Graphics 530 1536 MB
Storage: ...
0
votes
1
answer
312
views
Use @IBInspectable with any UIView subclass within storyboards
I have a class to use with @IBInspectable, to get the properties within my storyboard. Here is a small chunk of it:
/// UIView subclass to allow creating corners, shadows, and borders in storyboards.
...
2
votes
2
answers
358
views
Xcode - Is there a way to disable all IBInspectable temporarily, to speed up Storyboard?
I really like IBInspectable and IBDesignable features, that allow to speed up things and have a better view of final result, directly in Storyboard. But Gosh…they slow down soooo much my storyboard ...
0
votes
0
answers
237
views
IBInspectable: extracting data from value failed
I have built a library that adds a view to the screen and allows the developer to customize its appearance by entering custom values in IBInspectable fields.
It used to work just fine, except when I ...
0
votes
0
answers
185
views
Subclassing UISlider to customize thumb image using IBDesignable/IBInspectable?
I'm using this code from to customize my UISlider's thumbImage. It builds correctly in the storyboard but when I build and run it does not show my image? Could it be because I have it hooked up as an ...
1
vote
3
answers
4k
views
CornerRadius and Shadow on a UIView using @IBInspectable Swift 4.2
Is it possible to have both CornerRaduis and a shadow on a UIView?
I set up a Custom class for a UIView which uses @IBInspectable to set a cornerRadius and a addShadow which can be true or false. ...
-1
votes
1
answer
58
views
Interface Builder show all @IBInspectable in cascade
I'm maybe too complicated, but here is what I want:
@IBDesignable
class A: UIView {
@IBInspectable var title: String = "" {
didSet {
setNeedsLayout()
}
}
}
@...
2
votes
2
answers
1k
views
IBInspectable variable value is not changing in interface builder and simulator
I am creating custom parallelogram view and view is rendering fine with default offset value. But when i change the offset value from ib it's not working
@IBDesignable class CustomParallelogramView: ...
4
votes
0
answers
1k
views
@IBDesignable not rendering UILabel and UITextField texts
I've created a @IBDesignable subclass of UIView
The view has couple of labels and a text field.
When I try to change their value in the storyboard, the changes are not rendered. In constant changes ...
2
votes
2
answers
606
views
Create custom action in a class for use in Interface Builder
I want to create a custom action connection in a class, which should be visible in Interface Builder. For example - I add action / target properties to NSView class just like this:
weak open var ...
3
votes
1
answer
366
views
@IBInspectable property doesn't show up in Interface Builder
I have a class like this, and this IB doesn't show the property foo1 in inspection pane.
@IBDesignable
final class Foo: UIView {
@IBInspectable var bar1 = CGFloat(0)
}
What's wrong?
(Xcode 10....
2
votes
1
answer
351
views
IBDesignable for UIButton, IBInspectable vars are nil
I am having a strange problem with UIButton. I have the following custom class:
import UIKit
@IBDesignable class ToggleButton: UIButton {
@IBInspectable var state1Image: UIImage = UIImage()
...
0
votes
0
answers
108
views
How can you give design-time layout support to a custom UIView?
Just playing around to see if something can be done. I know I can give design-time support to certain properties by adding @IBInspectable to them, and I'm also aware of making the view itself support ...
2
votes
0
answers
57
views
At which order Interface Builder evaluates IBInspectables?
I have custom UI element designed with a help of IBInspectables, so that I can use and modify it in the Interface Builder. There are 2 inspectables which effectively change the same property of the ...
0
votes
2
answers
796
views
Unable to see the IBInspectable custom properties in Storyboard of the custom view class
I have created custom UIView class with IBDesignable method enable in it.
Inside the class, I have added few IBInspectable properties looks something like this,
Swift 4.0 - Snippet:
@IBDesignable
...
1
vote
2
answers
1k
views
how to corner Radius some edges in IBInspectable in swift 4?
so here is the code that is working well
let path = UIBezierPath(roundedRect:viewToRound.bounds,
byRoundingCorners:[.topRight, .bottomLeft],
cornerRadii: ...
2
votes
4
answers
3k
views
Swift IBInspectable didSet versus get/set
I am relatively new to IBDesignables and IBInspectable's and I noticed that a lot of tutorial use IBInspectable in this fashion.
@IBInspectable var buttonBorderWidth: CGFloat = 1.0 {
didSet {
...
2
votes
1
answer
509
views
Use of setter getter from another view controller
I've already created a CustomView(.Xib) with it's class(.Swift).
In order to reach it's views (widgets) property I've defined several getter and setter and for now I need to call them to modify but ...
1
vote
0
answers
562
views
Set UINavigationBar's gradient color using IBInspectable
So this is my custom class for UINavigationBar :
import UIKit
@IBDesignable
class GradientNavigationBar: UINavigationBar {
@IBInspectable var firstColor: UIColor = UIColor.clear {
...
2
votes
2
answers
3k
views
Value of @IBInspectable set in storyboard not propagated to the code
Without any experience with iOS, I have been asked to upgrade to Swift 4 an application that is using Swift 3. I updated the language to use in "Swift language version" and I followed the ...
0
votes
1
answer
351
views
IBInspectable run setup function every time IBInspectable value changes
I have an IBDesignable class which has an IBInspectable value: Int
value is basically the number of balls shown within the IBDesignable class
so I have a setup() func which adds the correct ...
0
votes
0
answers
465
views
Add RightView UIButton in UITextField Using IBInspectable
Is it possible to add rightView UIButton to a UITextField to StoryBoard using @IBInspectable ?
I want to create a uiTextfield like in this image using StoryBoard so that it will be easier in the ...
1
vote
1
answer
203
views
Swift @IBInspectables with priority choose the order are they executed in
I am playing a bit with @IBInspectables. I have created a reusable custom View which has some @IBInspectables.
Is there no way to give priority to the @IBInspectables to get executed?
In the ...
9
votes
1
answer
2k
views
How can we create IBInspectable like checkmark?
I created lots of IBInspectable. But today, I observed that Xcode having some properties like this:
In the link, I marked rectangle box. I want to create custom IBInspectable like that. I don't know ...
2
votes
2
answers
1k
views
extend class with IB_DESIGNABLE obj-c
I found IBDesignable and IBInspectable very usefull to bring setter possibility directly to the storyboard.
I use it in a swift projet that way
import Foundation
import UIKit
@IBDesignable ...
1
vote
0
answers
2k
views
@IBInspectable: Property cannot be marked
I keep getting this error:
Property cannot be marked @IBInspectable because its type cannot be
represented in Objective-C
.. why does its type need to be represented in Ojective-C? And is there ...
1
vote
2
answers
753
views
Apply IBInspectable to all view types in iOS
I'm trying to apply IBInspectable to all types of view like UIView, UIButton, UITextField, UIImageView, etc.
Here's what I did:
@IBDesignable
class BaseView: UIView
{
override func layoutSubviews(...
27
votes
8
answers
19k
views
IBDesignable Build Failed
I have Created IBDesignable and IBInspectable custom class to give shadow and corner radius for view
But When I assign Designable class to view, I get Designable Build Failed
This is my code
...
0
votes
2
answers
2k
views
How can I add section names in the Attributes inspector in Xcode?
Is there any way to add section name in newly added @IBDesignable properties for better readability.
//
//MARK: - Badge
//
@IBInspectable
var badgeColor:UIColor = UIColor.darkGray {
didSet {
...
0
votes
1
answer
1k
views
IB_DESIGNABLE and IBINSTECTABLE UIImageView
I'm trying to add a custom property to my subclass of UIImageView. The property type is of UIImageView. I have success with other data types, UIColor, int, etc. But UIImageView just doesn't appear in ...
2
votes
2
answers
3k
views
Custom UIButton @IBDesignable
I created a UIButton subclass that looks like a checkmark.
Here is the class:
import UIKit
@IBDesignable
class CheckedButton: UIButton {
// MARK: - Properties
@IBInspectable var checked: ...
11
votes
1
answer
1k
views
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 ...
12
votes
2
answers
2k
views
Xcode 9: Using named colors with IBDesignable and IBInspectable results in Interface Builder error, but compiles without issue
I use UIColor.named("myColor") throughout my app since Xcode 9 came out. While having a shot at a custom implementation of UITextField as an IBDesignable class, I kept getting the following error:
...
1
vote
1
answer
3k
views
@IBInspectable in Swift 4.0
While migrating to Swift 4.0, I am facing an issue with @IBInspectable,
open class SVContactBubbleView: UIView
{
@IBInspectable open var dataSource: SVContactBubbleDataSource? //ERROR..!!
@...
0
votes
1
answer
233
views
custom SKSpriteNode classes for use in .sks file?
I'm making a custom SKSpriteNode Class, which I want to use in my .sks file. I want it to have @IBInspectable property. Is it possible? And how can I implement its init(coder:) method, or there is no ...
0
votes
1
answer
77
views
Add attributes for UITableViewController
I'm developing a custom class.
The goal is user will add a UITableViewController to the storyboard and set its class to mine.
and my class will fill the tableView.
Here's my question: I want to give ...
11
votes
2
answers
3k
views
IBInspectable Properties not showing up in Xcode 8.3.3
While attempting to modify the Apple tutorial found here on IBinspectable properties for my own project I have run into a major roadblock.
I defined a simple button subclass:
import UIKit
@...
5
votes
2
answers
2k
views
How to control an UIView's rounded corners separately using @IBInspectable in Swift 3?
Here is my current code:
override func viewDidLoad() {
super.viewDidLoad()
let rect = Draw(frame: CGRect(
origin: CGPoint(x: 50, y: 50),
size: CGSize(width: 100, height: 100))...
1
vote
2
answers
3k
views
How to change the cornerRadius of button from storyboard with custom IBDesignable class created
The class given below is working fine
@IBDesignable class iButton : UIButton {
@IBInspectable var cornerRadius : CGFloat = 0.0{
didSet{
layer.cornerRadius = cornerRadius
}
}}
But ...