Questions tagged [swift4]

Use this tag only for questions directly related to changes in version 4 of Apple's Swift programming language. Use the tag [swift] for more general language questions, or the tags [ios], [cocoa], [apple-watch] etc. for questions about developing on Apple platforms.

Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

Nested Tableview inside CollectionView not loading from first index

The problem is I have a Parent TableView and Inside Tableview I have a CollectionView and Inside collection I have another Tableview for each Cell.My Problem is I am not able to load first 0th item of ...
vanitha's user avatar
  • 15
0 votes
0 answers
149 views

Face comparison of two images using Tensorflow Lite and Google ML Kit library

I am trying to compare 2 images , I cropped face from images now I want to compare them But below codes have errors , unable to fix it, Please help, Below is my code which I am trying to compare faces ...
DSRawat's user avatar
  • 79
0 votes
0 answers
70 views

Tried to implement the TLS/SSL connection from TCP connection in Swift 4 using Network library

Currently, We are developing a MacOS application and the app can connect successfully to a server "X.X.X.X:YYYY" with default TCP Option and none TLS by NWConnection. Note: the host name ...
Khang's user avatar
  • 11
0 votes
1 answer
129 views

Is it possible to make 2 subviews with same z index?

I am looking to create a water fill effect into a shape and am using WaveViewAnimation project. I want to allow the user to press on different buttons to create different colour waves to fill the ...
SriTeja Chilakamarri's user avatar
0 votes
1 answer
76 views

How to Make array of username clickable in UI Label each username should redirect to another page without using @, # , I want every username clickable

If I click on the first username "Kelly Kapoor" it should redirect to another page and when I click on the second username "Jim Halpert" it should redirect to another page. I've ...
Darshan Virani's user avatar
-1 votes
2 answers
140 views

How to check enum in same value using switch in swift

I'm kinda block for this scenario , I have a enum which have the same value now the question here is that they have different usecases how can I put a condition for this to case in switch: supposed I ...
User Unknown's user avatar
  • 1,079
1 vote
0 answers
74 views

Swift 5 very random and hardly identifiable crashes

My crash log from firebase unfortunately doesnt really help me finding a solution to my issue. Crashed: com.apple.main-thread 0 MyApp 0x94d30 PostsAPI.loadNewestPosts(...
Zash__'s user avatar
  • 293
0 votes
0 answers
141 views

Crash in custom cell when leaving and re entering app

I have a weird crash which I cannot solve. I have a tableview which displays data which works just fine. When I leave the app and re enter it (without killing it) it sometimes (really seldom, like in ...
Zash__'s user avatar
  • 293
0 votes
1 answer
417 views

Swift migration: 'Notification' is ambiguous for type lookup in this context' in some places

I'm making a migration from Swift 2.3 to Swift 5 with a lot of pain and well, I'm ending the migration but I'm still getting an error in some places of the code: Notification' is ambiguous for type ...
Final_Odin's user avatar
0 votes
1 answer
368 views

UIApplication.keywindow ,must be used from main thread only warning

DispatchQueue.main.async { } This cause error in my Extension How I use it let topController = UIApplication.shared.topMostViewController()
9to5ios's user avatar
  • 5,379
0 votes
1 answer
53 views

Replace Gradient colors with ThemeSwift library (Library used for App Theme management)

How to use this library for gradient colors as they haven't mentioned the usage of gradient with ThemeAnyPicker in their documentation. I am using plist method which is much easier way than the other ...
Jaseel.Dev's user avatar
5 votes
0 answers
430 views

iOS 15 - UICollectionView disappear while scrolling only in iOS 15

this is the second time I posted here about this issue and no one could help me my project was good in iOS 14 and previous versions when I debug my app on simulator or real device that have iOS 15 the ...
Joseph's user avatar
  • 63
1 vote
0 answers
86 views

Create Long length Haptic in iWatch swift

Hi i am aware that apple does not allow us to create core haptic in iWatch instead it make us to use the default haptic it has. But the default haptics are of short length. Can I get help to know how ...
Supreet Patil's user avatar
0 votes
2 answers
164 views

How to allow only single UIViewController to rotate upside down with Xcode?

In my app all screens have portrait orientation. How to allow only single UIViewController be in two orientation mode: portrait and upside down? When user rotates an iPhone, the UIViewController ...
Stanislav Putilov's user avatar
3 votes
0 answers
177 views

How can I use old binary library TinyCrayon on latest iOS project?

I tried to use TinyCrayon in my new iOS project. The library consists of a binary library framework. The link of the framework is dead in the TinyCrayon readme but it can be found here. When I add the ...
oOEric's user avatar
  • 1,069
0 votes
2 answers
428 views

how to put default value in fetch request predicate in coredata ios?

im working in ios swift, here i have used core data to store values and written some function to find the data and return it. public func insertdetails (id:String, data:String, createdAt:String){ do{ ...
Muthukumar Lenin's user avatar
0 votes
1 answer
1k views

Swift generics issue: generic parameter could not be inferred

With this code: public protocol LoginInfoBase: Decodable { var access_token: String? { get } var notifications: [PushNotification] { get } } public class ExampleLoginInfo: LoginInfoBase { ...
Dylan's user avatar
  • 2,325
-2 votes
1 answer
188 views

Why does the large title not work when I use the Turkish character "ç"? [closed]

Why does the banner not work when I use the Turkish "ç" character? I've tried everything, everything seems fine. But I only get such an error in the "ç" character, has anyone ...
Osman Yıldız's user avatar
2 votes
1 answer
937 views

Unable to download PKpass from server

I've been trying several links to download pkpass from server but whenever i download it it shows me the size of file "0 kb", due to this i cannot convert it to pkpass data. is there any ...
Furqan Baig's user avatar
0 votes
1 answer
96 views

Xcode 12.5 NSCoding issue with SpriteKit/GameplayKit

I'm working on application using SpriteKit and I'm having trouble with NSCoding on a particular object (a GKComponent object). I'm using Swift 4.0 and iOS 11 in Build Settings. The application always ...
Bob's user avatar
  • 182
0 votes
2 answers
262 views

call a method from another class with required init coder

I have a class with a required init coder that I have a method I would like to call from another class. Im unsure how to instantiate this class. first class I want to call import UIKit import ...
user avatar
1 vote
0 answers
456 views

Edit saved data in Core data using swift

I am building an app in swift which has takes user details like Name, age, gender, picture, About me. I am saving all the data in core data and and displaying it in tableView. It also has a swipe to ...
Asad's user avatar
  • 11
1 vote
2 answers
965 views

Reload tableview without scroll

I am new to swift I want to reload my tableview so I used tableviewName.reloadData() After this the table view is reloaded and scrolled a bit upwards but I want to stay where it is Here is the code ...
Crist's user avatar
  • 39
0 votes
1 answer
728 views

Refresh Bearer Token and resume current API

I need to resume my WebService if my bearer token expire by http code 401 , below is my code. When a 401 error occurs that means the Access Token has expired and I need to send a Refresh Token over ...
9to5ios's user avatar
  • 5,379
-2 votes
1 answer
346 views

Programmatically emptying UIStackView

I have a fairly simple code which, upon clicking a button, adds a randomly colored UIView to a UIStackView, and upon a different button click, removes a random UIView from the UIStackView. Here's the ...
Idanis's user avatar
  • 1,948
1 vote
3 answers
1k views

Array with multiple values per index?

I'm learning swift, and I do the sololearn course to get some knowledge, but I bumped into something that I don't understand. It is about modifying an array's values. The questionable part states the ...
Somee's user avatar
  • 21
12 votes
1 answer
523 views

Tapping on a video in a table view cell to open it in a view controller

tl;dr I'm trying to recreate this in the Twitter app: https://i.imgur.com/173CVyM.mp4 As you can see, Twitter plays a video in the feed (table view cell) and when the video is tapped, the video ...
user86516512's user avatar
1 vote
1 answer
192 views

Text View placeholder being cut off

I have a custom UITextView that shows a placeholder, like so: extension UITextView { private class PlaceholderLabel: UILabel { } private var placeholderLabel: PlaceholderLabel { if ...
user86516512's user avatar
-2 votes
1 answer
87 views

Xcode Storyboard file displaying source control diff interface

When I click on my Storyboard file, I can't see the UI I made. It's showing some code instead of my UI. How can I see my Storyboard user interface?
Syed Asad Ali Kazmi's user avatar
0 votes
1 answer
163 views

Confused about async block inside loop

I want to print the data only after executing all loops inside the closure block, since I don't know how to use dispatch group exactly. I have tried in several ways. What am I doing wrong here? ...
Jaseel.Dev's user avatar
1 vote
1 answer
1k views

Replace all line breaks with a space in a UITextView

I have a UITextView. I want to disable all line breaks in the text view, whether they're typed manually or if the user pastes text that contains line breaks, and replace each line break with a space (&...
user86516512's user avatar
0 votes
1 answer
122 views

Smaller button over a big button in swift

I am new to swift and iOS development. I have created a scroll view with table view cells and image views inside cells. Each Image view has a button with same constraints. I have a fixed button in the ...
Sanjay's user avatar
  • 23
4 votes
1 answer
1k views

How to change UITextField size inside UIViewRepresentable in SwiftUI

I want to make a simple custom UITextField and I can't figure out how to set its height. The problem is the UITextField expands to fill parent, and I realise I can set .frame() modifier on the ...
Elisey Ozerov's user avatar
0 votes
0 answers
80 views

Click button to add additional text fields not working

I have a poll system where users are able to create polls. Each poll must have at least two options, with the ability to add up to four. Right now, I have a collection view cell for each text field, ...
user86516512's user avatar
1 vote
2 answers
113 views

Deinit not calling - Cannot find why something is retaining (code provided)

I have discovered that my UIViewcontroller is not calling deinit() under the following scenario. I am using this code extension to make my life easier by adding tap gesture recognizers. https://gist....
NullHypothesis's user avatar
0 votes
0 answers
73 views

Scheduled IOS local notifications repeat every minute

I have an IOS app that schedules a local notification on the day the app is opened, and every day at roughly the same time for the next 7 days. What happens is each notification is repeated the number ...
SamMaj's user avatar
  • 358
0 votes
2 answers
914 views

Adding time from string into date object swift

I have a time coming from service in string form like so "12:30 PM". I am able to get this time but I want to add this time in current date. like so 31/3/2021 12:30 PM The current date is ...
A.s.ALI's user avatar
  • 1,992
0 votes
0 answers
610 views

Decoding Base64 in Swift Returns nil

I have been trying to implement Coinbase API in my application that is built using swift 5 and xcode. Whenever I try to convert this base64 encoded data to Normal string, it returns nil. Here is the ...
ineedtolearntoeat's user avatar
-1 votes
1 answer
705 views

SwiftUI simple Pop-Up Alert from a function in a class

I am a little confused, I try to display a pop-up in my View when my function is true otherwise continue but I do not understand how to do it I am lost between the different ways of doing. I tried ...
luck99's user avatar
  • 41
0 votes
0 answers
51 views

What is the safest way to create the coredata stack

In order to initiate the coredata stack in app delegate is not recommended as it will create issue in a multi threaded environment. Therefore, I created a separate class for coredata stack and then a ...
danu's user avatar
  • 1,108
0 votes
0 answers
70 views

Change Button image from view controller inside custom header cell

I have a VC that is UICollectionView that has header. This header is a custom cell, and inside that cell there is an button with image which I need to change based on info from API or user tap. In ...
learningswift's user avatar
2 votes
2 answers
2k views

Swift base64 decode non alphabetic and non utf-8 strings

Is it possible to correctly decode using Swift language base64 encoded string which contains a string in non-utf8 encoding (ie. Windows-1252 or ISO-8859-1)? Every snippet of code that can be found ...
moogeek's user avatar
  • 417
0 votes
3 answers
562 views

How to give size to table view to XIB

I am new to iOS practicing XIB I have created an XIB for a cell Now When I resize it from here I automatically change its behaviour in tableview I want to give this XIB with as 100% of tableview. I ...
Noor Ahmed Natali's user avatar
0 votes
1 answer
647 views

Swift - Problem with scrollview (Need to print when dragging down)

I am testing the swiping controller/gesture from Jake Spracher with his SnapchatSwipeView (https://github.com/jakespracher/Snapchat-Swipe-View ) I have setup a topVC,leftVC,rightVC and middleVC(the ...
Victor's user avatar
  • 71
2 votes
1 answer
1k views

Safe JSON Decoding. Still getting Key not found: No value associated with key'

IMGUR image search returns json: {"data": [{ "title": "Family :)", "images": [{ "title": null, ...
Mr_Vlasov's user avatar
  • 515
0 votes
2 answers
230 views

How to create model object for Imgur JSON | Swift

Imgur image search response has following structure (simplified) : { "data": [ {"title" : "Kittens", "images" : [ { "title" : "&...
Mr_Vlasov's user avatar
  • 515
0 votes
1 answer
403 views

Beginner stuck with a problem with NSScreen.screens

I'm a beginner with swift and I'm learning as I go with a project for myself. Right now, I'm trying to make a "kiosk mode" window appear that maximizes to fill the entire screen while the ...
Alexei Yakovich's user avatar
1 vote
0 answers
231 views

Navigation controller is nil after switching the rootviewcontroller

I have to change / switch rootviewcontroller to user home page when login is success. But when I change rootviewcontroller here I can't navigate to another page from buttons inside home view ...
Jaseel.Dev's user avatar
0 votes
1 answer
544 views

Can't initialize crashlytics in iOS

Followed all instructions showed in this video: https://www.youtube.com/watch?v=qFQLG1Hlzis As well as all instructions that are shown here: https://firebase.google.com/docs/crashlytics/get-started My ...
jbeltran's user avatar
-2 votes
1 answer
70 views

Unable to Extract Data from the Dictionary<String, Any> in swift

I have a Dictionary<String, Any> Data in the following format. I need to extract the values from it.I am unable to extract the values, initially it looked to me as JSON but it's of type ...
Ankit's user avatar
  • 67

1
2 3 4 5
114