This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let provider = SSProvider<UserProvider>() | |
| provider.request(.getUser(name: "Serhat")) { (response, error) in | |
| if let response = response { | |
| print("result \(response.result)") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) { | |
| System.out.println("Üçgen hesaplama: " + calculateTriangle(18)); | |
| } | |
| static String calculateTriangle(int sum) { | |
| int dividedAngle = sum % 3; | |
| int[] angles = {dividedAngle, dividedAngle, dividedAngle}; | |
| int previousAngle = 0; | |
| int[] matchedAngles = new int[2]; | |
| for(int i=0; i<angles.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Here we are creating representables for to take advantage of all representables. | |
| typealias Representables = TextPresentable & SwitchPresentable & ImagePresentable | |
| class ProductListCell: UITableViewCell { | |
| @IBOutlet private weak var label: UILabel! | |
| @IBOutlet private weak var switch: UISwitch! | |
| @IBOutlet private weak var imageView: UIImageView! | |
| func configure(presenter: Representables) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // OrderRepresentable.swift | |
| protocol OrderRepresentable { | |
| var name: String { get } | |
| var description: String { get } | |
| var price: Int { get } | |
| } | |
| // Order.swift | |
| struct Order: OrderRepresentable { | |
| var name: String = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // OrderViewModelRepresentable.swift | |
| protocol OrderViewModelRepresentable { | |
| var title: String { get } | |
| } | |
| // OrdersViewModel.swift | |
| struct OrdersViewModel: OrderViewModelRepresentable { | |
| fileprivate var order: Order | |
| init(model: Order) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class OrdersViewController: UIViewController { | |
| // Create strong data source objects | |
| // Because tableView has a weak reference so it can be deallocated. | |
| let orderDataSource = OrderDataSource() | |
| let completedOrdersDataSource = CompletedOrdersDataSource() | |
| public enum OrderTabs: Int { | |
| case current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // OrderDataSource.swift | |
| class OrderDataSource: NSObject, UITableViewDataSource { | |
| fileprivate let data: [OrdersViewModel] = [ | |
| OrdersViewModel(model: Order(name: "Order - 1", description: "Description - 1", price: 100)), | |
| OrdersViewModel(model: Order(name: "Order - 2", description: "Description - 2", price: 200)), | |
| OrdersViewModel(model: Order(name: "Order - 3", description: "Description - 3", price: 300)), | |
| OrdersViewModel(model: Order(name: "Order - 4", description: "Description - 4", price: 400)), | |
| OrdersViewModel(model: Order(name: "Order - 5", description: "Description - 5", price: 500)) | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func testOrdersViewModel() { | |
| let orderModel = Order(name: "Order 1", description: "Margaritta Pizza", price: 15) | |
| let orderViewModel = OrdersViewModel(model: orderModel) | |
| XCTAssert(orderViewModel.title == "Name:Order 1\nDescription:Margaritta Pizza\nPrice:15$", "This is not valid order") | |
| } | |
| func testCompletedOrderModel() { | |
| let completedOrderModel = CompletedOrder(name: "Completed order 1", description: "Margaritta Pizza", completedDate: "17/04/1992", userRating: 5.5, price: 10) | |
| XCTAssert(completedOrderModel.completedDate == "17/04/1992", "Date format is not correct!") | |
| XCTAssert(completedOrderModel.price == -100, "Price is not valid") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| platform :ios, '9.0' | |
| use_frameworks! | |
| def pod_files | |
| # ProgressBar | |
| pod 'SVProgressHUD' | |
| # Keyboard hiding | |
| pod 'IQKeyboardManagerSwift', '5.0.0' | |
| # Networking | |
| pod 'Alamofire', '~> 4.5' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Errormessage: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ) WHERE pr.regions_id ='1' AND pl.name LIKE '%cola%' AND pr.stock>0 AND' at line 1<br>0 : <b>/home/treegroup/domains/treegroup.com.tr/public_html/demo/bring365/api/search.php</b> (line : <b>33</b>) / select <br>1 : <b>/home/treegroup/domains/treegroup.com.tr/public_html/demo/bring365/class/dbFunctions.php</b> (line : <b>201</b>) / query <br>{"status":false,"message":"\u00dcr\u00fcn Bulunamad\u0131."} |