Hi, build fail, any idea? thanks
No program, no idea. If you supply your program though, we might be able to help.
Edit:
My build failed, any idea
Trying to run my program...
No error, just fail, thanks
βββββββββββ-
My first attempt at a haiku Not very good but still worth a shot
//
// File.swift
// searchbar
//
// Created by Mac on 2019-07-23.
// Copyright Β© 2019 Mac. All rights reserved.
//
import Foundation
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate{
func tableView( _ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
func tableView( _ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
<#code#>
}
private func tableView( indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
weak var searchBar: UISearchBar!
weak var tableView: UITableView!
var searchActive : Bool = false
var data = ["Securitas", "Beta", "Alfa"]
var filtered:[String] =
override func viewDidLoad() { super .viewDidLoad()
/ Setup delegates /
tableView.delegate = self
tableView.dataSource = self
searchBar.delegate = self
}
func searchBarTextDidBeginEditing( _ searchBar: UISearchBar) {
searchActive = true ;
}
func searchBarTextDidEndEditing( _ searchBar: UISearchBar) {
searchActive = false ;
}
func searchBarCancelButtonClicked( _ searchBar: UISearchBar) {
}}
Can you reformat your post as code to preserve the original formatting?
Ok, how do I do that? , thanks
Put it in triple grave accent like this
```
Some code
```
Which will produce
Some code
Usually when you paste code inside the code block, itβll automatically preserve the indentation, use fixed-width font, etc. Making it much easier to read as code.
PS
This should fall under category Using Swift, not Development.
Development is for when you want to make change to Swift compiler, or something.
Hi Lantua, ok I have done that. On top of script and end. In the end I get "Expected expression". Something wrong? Thanks
Oh, I mean to put it in the forum, so that this website knows where is the start of the code and where is the end. Not to put it in the actual project youβre trying to compile.
ok:)
*//*
*// File.swift*
*// searchbar*
*//*
*// Created by Mac on 2019-07-23.*
*// Copyright Β© 2019 Mac. All rights reserved.*
*//*
**import** Foundation
**import** UIKit
**class** ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate{
**func** tableView( **_** tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
**func** tableView( **_** tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
<#code#>
}
**private** **func** tableView( indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
**weak** **var** searchBar: UISearchBar!
**weak** **var** tableView: UITableView!
**var** searchActive : Bool = **false**
**var** data = ["Securitas", "Beta", "Alfa"]
**var** filtered:[String] = []
**override** **func** viewDidLoad() { **super** .viewDidLoad()
*/* Setup delegates */*
tableView.delegate = **self**
tableView.dataSource = **self**
searchBar.delegate = **self**
}
**func** searchBarTextDidBeginEditing( **_** searchBar: UISearchBar) {
searchActive = **true** ;
}
**func** searchBarTextDidEndEditing( **_** searchBar: UISearchBar) {
searchActive = **false** ;
}
**func** searchBarCancelButtonClicked( **_** searchBar: UISearchBar) {
}}
Better? :)
It seems you tried to paste the code first (and the website then try to be smart by inserting the **
to make bold text for you), then put ``` around it.
A better way is to put ``` for both beginning and the end first, then paste the code inside. That how you'll avoid the extra **
.
Anyhow, let me give you a little help
//
// File.swift
// searchbar
//
// Created by Mac on 2019-07-23.
// Copyright Β© 2019 Mac. All rights reserved.
//
import Foundation
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate{
func tableView( _ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
func tableView( _ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
<#code#>
}
private func tableView( indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
weak var searchBar: UISearchBar!
weak var tableView: UITableView!
var searchActive : Bool = false
var data = ["Securitas", "Beta", "Alfa"]
var filtered:[String] = []
override func viewDidLoad() {
super .viewDidLoad()
/* Setup delegates */
tableView.delegate = self
tableView.dataSource = self
searchBar.delegate = self
}
func searchBarTextDidBeginEditing( _ searchBar: UISearchBar) {
searchActive = true ;
}
func searchBarTextDidEndEditing( _ searchBar: UISearchBar) {
searchActive = false ;
}
func searchBarCancelButtonClicked( _ searchBar: UISearchBar) {
}
}
At first glance it seems there's nothing wrong. but you'll notice <#code#>
. It's called placeholder. Placeholder is used in place you'd expect something to be there, in this case it's code.
The compiler should tell you to replace placeholder with whatever you want it to be, not just crash. You could try to file a bug report.
Anyhow, in the project, you should replace <#code#>
(which should look like a round blob written code
) with the logic in your code. Xcode tries to fill in the blank for you, but it doesn't know much (neither am I), that's why it just put placeholders there.
Ok, thanks Lantua :)