[Solved] Editor placeholder in source file swift [duplicate]

You need to write it like this: func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: “MenuCollectionViewCell”, for: indexPath) as! MenuCollectionViewCell return cell } 3 solved Editor placeholder in source file swift [duplicate]

[Solved] How to open Documents files of device programmatically in iOS [closed]

To open office files within an iOS app you can: 1- Use UIWebView . Here is a sample code with a document included in the app’s resources. NSString *path = [[NSBundle mainBundle] pathForResource:@”document” ofType:@”ppt”]; NSURL *url = [NSURL fileURLWithPath:path]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [self.webView loadRequest:request]; 2- You can use the QuickLook framework to preview … Read more

[Solved] Swift Array append not appending values but replacing it

There is not enough information but I can guess you where you have made mistake. Your class Bookmark is not singleton class so,every time Bookmark() create new instance every time. that means it will create new bookmark object for every instance. What I suggest you is inside func func setBookmark(imageURL:String, title:String, description:String, summary:String, date:String, link:String) … Read more

[Solved] Date string convertion wrong month

As you need please use below method. it will give you proper month formated date func monthFormatechange(_ dateString : String) -> String { let dateFormatter = DateFormatter() dateFormatter.dateFormat = “dd-MM-yyyy” let date = dateFormatter.date(from:dateString) dateFormatter.dateFormat = “dd-MMM-yyyy” let actualDate = dateFormatter.string(from: date!) return actualDate } solved Date string convertion wrong month

[Solved] Open a link when alert ok button is pressed [closed]

You don’t actually need pathAlert.delegate = self. You’ve already set the delegate in the initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles: method call. In your .h file, you need to do this: @interface YourViewControllerName : UIViewController <UIAlertViewDelegate> And in the .m file add this method: – alertView:(id)alert didDismissWithButton:(int)index { [[UIpplication sharedApplication] openURL:[NSURL URLWithString:@”foo”]; } Alternatively, and possibly better might be to … Read more

[Solved] i want create a CollectionView for images with auto scrolling like loop

Use this code. I hope this helps you. Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(moveToNextPage), userInfo: nil, repeats: true) @objc func moveToNextPage (){ if self.x < dataArray.count { let indexPath = IndexPath(item: x, section: 0) sliderPageCont.currentPage=x sliderColletion.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true) self.x = self.x + 1 } else { self.x = 0 } } solved … Read more

[Solved] How to check if 2 Dates have a difference of 30days? [duplicate]

You can convert both dates to seconds with timeIntervalSince1970 and then check if difference is bigger than 2592000 (30*24*60*60 which is 30 days * 24 hours * 60 minutes * 60 seconds). NSTimeInterval difference = [date1 timeIntervalSince1970] – [date2 timeIntervalSince1970]; if(difference >2592000) { //do your stuff here } EDIT: For more compact version you can … Read more

[Solved] Get an iPhone UDID from Mobile Safari

Apple Server plays no role while you retrieve the UUID from the device by the above method mentioned in your question. You can check this by creating a hotspot and connect both your phone and the server which serve the .mobileconfig file to the hotspot. install the provision file on your phone and it will … Read more

[Solved] How to create JSON Codable using Swift [closed]

This is a starting point. The structs are pretty straightforward. If one of the Division arrays is empty – asked in one of your previous questions – the corresponding array is empty, too. struct Root : Decodable { let status : Bool let data: DivisionData } struct DivisionData : Decodable { let school, college, office, … Read more

[Solved] Navigation Bar gets funky if Swipe Gesture and Back Button are triggered at the same time

To fix this I disable user interactions for the navigationsbar. To do so, I subclass UINavigationViewController and use Key-Value-Observing to detect the state of the gesture recognizer. #import “NavigationViewController.h” @interface NavigationViewController () @end @implementation NavigationViewController – (void)viewDidLoad { [super viewDidLoad]; [self.interactivePopGestureRecognizer addObserver:self forKeyPath:@”state” options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:NULL]; } – (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void … Read more

[Solved] Is it true that using view controllers and viewDidLoad method for implementing my methods? [closed]

You don’t have to use (performSelector:withObject:afterDelay:) all the time ! Say you have two methods implemented in your viewController : -(void) firstMethod { //do stuff here } -(void) secondMethod { //do stuff here } you can call those methods this way : – (void)viewDidLoad { [super viewDidLoad]; [self firstMethod]; [self secondMethod]; } Now what we … Read more

[Solved] Checking whether elements of an Array contains a specified String

NSString has a rangeOfString function that can be used for looking up partial string matches. This function returns NSRange. You can use the location property. … NSArray *qwer = [NSArray arrayWithObjects:@”Apple Juice”,@”Apple cake”,@”Apple chips”,@”Apple wassail”nil]; for (NSString *name in qwer){ if ([name rangeOfString:keyword].location == NSNotFound) { NSLog(@”contains”); } } … Reference : https://developer.apple.com/reference/foundation/nsstring/1416849-rangeofstring https://developer.apple.com/reference/foundation/nsrange Thanks … Read more