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.

Swift 4 is the fourth version of the Swift language developed by Apple that was released in 2017. The language is open source and available on Github (see ).

The development of Swift 4 and its goals can be viewed on the Swift Programming Language Evolution repository on GitHub.

5684 questions
1
vote
1 answer

Swift KVO holding object reference count

I add observers in my swift code as follows: private var keyValueObservations = [NSKeyValueObservation]() And then in code let keyValueObservation = session.observe(\.isRunning, options: .new) { _, change in guard let isSessionRunning =…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
vote
1 answer

Posting video data Swift

I have an application which records a video and saves it to Photos. I am trying to retrieve the saved video and post it to the server using an API. Here is my code for the same: var request = URLRequest(url: URL(string:…
1
vote
0 answers

Sort multiple data from the rapid fire base in Table view cell in alphabetical order by Initials Gold

I'm doing a dictionary application. firebase also has a dictionary title and description. I pull this data into x code. I will show the title in the table view cell. but I could not sort it in alphabetical order, for example; to apple B book I want…
1
vote
2 answers

iOS Swift stream audio from shoutcast or icecast using AVFoundation

I'm trying to create a radio app that gets audio from Shoutcast or Icecast. I've been able to play music from a http url that ends in mp3 (ex: https://soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3). I can not stream from a url like this (ex:…
1
vote
1 answer

Disable Automatic adjusting font for UILabel,UIText,etc. in iOS/Swift?

Go to "Settings"-> "General"-> "Accessibility"-> "Larger Text" to change the font size. Open my app, now all the UILabels and UIButtons do change accordingly. I want to disable it and want to keep as it is regardless of the large font or small font…
xeb
  • 191
  • 1
  • 4
  • 12
1
vote
2 answers

Check if NSSize is nil - Comparing non-optional value of type 'NSSize'?

I have a NSSize variable var originalselectedimagesize:NSSize if(originalselectedimagesize == nil) { } I'm trying to check if NSSize is set ? But i keep getting the following warning.How can i check if the value of NSSize is changed? h(aka…
techno
  • 6,100
  • 16
  • 86
  • 192
1
vote
1 answer

Add progress view to UITableViewCell

I want to display my upload progress of a file in the table view cell. I am using Progress View programatically for the same. However, the progress view overlaps the file name and its related data. How can I make the progress view appear behind the…
1
vote
1 answer

Swift 4 wrong date and time

I am struggle with timezone because I tried to set time to midnight to 23:00:00, however, the result show start with 6am until 5am next day. I tried to set timezone to current, still same result. Here my code let day1num =…
user12616082
1
vote
1 answer

How do implement UIScrollView and UIPageControl Programmatically in Swift4?

Recently I want to implement the UI of Image and text slide show, because of my personal reasons: App pages are implemented by program code. I spent some time researching the usage of UIScrollView and UIPageControl, and found this link(How to create…
Bingerz
  • 1,027
  • 1
  • 11
  • 15
1
vote
1 answer

How to use photo from photo library ios every time the apps loads?

im trying to do the follow : user is picking image from photo lib as profile pic -> from now on this image will use as profile pic even if the app closed . im using this code : if let imageUrl =…
1
vote
0 answers

Displaying an empty UITableView row by using an empty 2D string array in swift 4

I am trying to display an empty row in the UITableView by using an empty 2D string array but keep on getting the “Index out of range” error on the "cell.textLabel?.text" line. Can someone please help me? Thank you. import UIKit class…
techyCode1
  • 49
  • 5
1
vote
0 answers

crash in iOS 10 and iOS 9 with CoreFoundation - common_removeAllObjects

Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000020 common_removeAllObjects CoreFoundation common_removeAllObjects + 156 The above given is the stack trace.Not able to find a reference in the code. I am not able to…
sreehari
  • 43
  • 5
1
vote
1 answer

Swift - How to detect one eye blink

I use CoreImage to detect eye blinking, it works fine except when I try to detect only one eye. Any ideas in how to detect eye contact flirting by using CoreImage? if let faceImage = CIImage(image: target) { let accuracy =…
1
vote
1 answer

Returning an NSRectangle with Equal width and height

I use the following code to return an NSRectangle let ciimage = ciImage.cropped(to: $0.bounds.insetBy(dx: -$0.bounds.width/1.6, dy: -$0.bounds.width/1.6) ) But the returned rectangle has unequal width and height.How can i make it a square?
techno
  • 6,100
  • 16
  • 86
  • 192
1
vote
1 answer

White Border around Resized Image

I'm using the following code to resize an image.But i keep getting a white border at the bottom func resize(withSize targetSize: NSSize) -> NSImage? { let size=NSSize(width: floor((targetSize.width/(NSScreen.main?.backingScaleFactor)!)),…
techno
  • 6,100
  • 16
  • 86
  • 192