Question: I'm trying to add a color picker in my add and I use this <https://github.com/gizmosachin/ColorSlider> library which is only written in swift and I use objective-c. I have followed this guide [How to call Objective-C code from Swift](https://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift) on how to add swift libraries in objective-c projects. I'm 99% sure that I have properly configured xcode because I can import the swift library and run my app without an error, it's only when I try to instantiate the swift class that the app crashes and I see that the init method for the swift class is called infinitely. The source code for the library is one file and listed for reference just in case (<https://github.com/gizmosachin/ColorSlider/blob/master/Source/ColorSlider.swift>) 

Here is one of the init methods (the other inits are overrides)

```
// MARK: Initializers
convenience init() {
    println("hi there swift")
    self.init()
    backgroundColor = UIColor.clearColor()
}

```

in my log I see "hi there swift" print out many times. This is how I initiate the swift class

```
ColorSlider *colorSlider = [[ColorSlider alloc] init];

```

I know that the function containing the line of code above is only being called once because I used NSLog(@"output") to see how many times this shows up and the output looks like this

```
output
hi there swift
hi there swift
hi there swift
hi there swift
hi there swift
etc...to infinity or until app crashes

```

Am I instantiating the swift class correctly? I'm not sure why the swift class's init method is called infinitely

----**UPDATE**-----

It looks as if the init methods below also use super.init?
[![enter image description here](https://i.stack.imgur.com/rKWiq.png)](https://i.stack.imgur.com/rKWiq.png)

Answer: 
When you instantiate your form, you'll want to call it with the `auto_id` keyword set to a string with the format character '%s' which will be replaced by the field name.

So you'll want to do this:

`ReviewForm(auto_id="test_%s")`

And your ids will be generated with `test_` as a prefix, followed by the field name.

Direct from the Django 1.8 docs:

> 
> Use the auto\_id argument to the Form constructor to control the id and label behavior.
> 
> 
> ...
> 
> 
> If auto\_id is set to a string containing the format character '%s', then the form output will include tags, and will generate id attributes based on the format string. For example, for a format string 'field\_%s', a field named subject will get the id value 'field\_subject'.
> 
> 
> 

<https://docs.djangoproject.com/en/1.8/ref/forms/api/#configuring-form-elements-html-id-attributes-and-label-tags>
I found a way to do this, explained [here](https://docs.djangoproject.com/en/1.8/ref/forms/widgets/) 

```
[class ReviewForm (forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(ReviewForm, self).__init__(*args, **kwargs)
        self.fields\['location'\]=forms.CharField(widget=forms.TextInput(attrs={'id':'myField'}),label='', required=False)
        self.fields\['review'\]=forms.CharField(widget=forms.TextInput(attrs={'id':'myField'}),label='', required=False)

```