r/iOSDevelopment • • Jul 23 '22

I made a simple music app for toddlers road trip entertainment

3 Upvotes

For my 2yo I wrote this tiny app, because we're going on a road trip and entertainment will be key. We found an app that shows a bunch of tiles and when you press a tile it starts playing music, but it malfunctions and crashes constantly. So, "how hard can it be?" I wrote a dead-simple app myself. Each tile corresponds to a song, when you press it the tile will be highlighted and the song will play on repeat. When pressed again it stops. That's all.

Here's a screenshot and here's the code. Let me know if you use it or if you run into any issues compiling and running it.

I use Xcode 13.4.1 and run this on an iPad Air and an iPad Pro gen2. Here are some instructions, as complete as I manage from the top of my head:

  1. create an iOS App project

  2. put this code in ContentView.swift

  3. add mp3's to the project (right next to the swift files and assets)

  4. in the Assets add the cover pictures (you can also add an app icon there)

  5. register as a developer (it's free) and have your project signed by clicking the project (topmost entry in the left sidebar) -> "Signing & Capabilities" tab -> "Team"

  6. instead of a simulator, select your iOS device (after connecting it to your computer with a cable) and compile/run your project

  7. done!

import SwiftUI
import AVFoundation

var audioPlayer: AVAudioPlayer!

struct Song: Hashable {
    let index: Int
    let imageName: String
    let trackName: String
}

struct ContentView: View {
    @State private var playingSong:Int = 0
    
    let songs : [Song] = [
        Song(index: 1, imageName: "cover1", trackName: "song1"),
        Song(index: 2, imageName: "cover2", trackName: "song2"),
        Song(index: 3, imageName: "cover3", trackName: "song3")
    ]
    
    private let adaptiveColumns = [
        GridItem(.adaptive(minimum: 175, maximum: 175)) // ipad air: 160, ipad pro: 175 (24 songs)
    ]
    
    var body: some View {
        //ScrollView { // uncomment this line and add a } below to get a scrollbar
        LazyVGrid(columns: adaptiveColumns, spacing: 20) {
            ForEach(songs, id: \.self) { song in
                Button(action: {
                    do {
                        print("currently playing song: \(playingSong)")
                        let soundFileURL = Bundle.main.url(forResource: song.trackName, withExtension: "mp3")
                        audioPlayer = try AVAudioPlayer(contentsOf: soundFileURL!)
                        guard let player = audioPlayer else { return }
                        if playingSong == song.index {
                            player.pause()
                            playingSong = 0
                        }
                        else {
                            player.numberOfLoops = -1
                            player.play(atTime: player.deviceCurrentTime + 1.1)
                            print("playing: " + song.trackName)
                            playingSong = song.index
                        }
                    }
                    catch { print("error occurred") }
                }) {
                    ZStack {
                        let current = song.index == playingSong
                        let glowRadius = !current ? 0.0 : 12.0
                        Image(song.imageName)
                            .resizable()
                            .scaledToFit()
                            .shadow(color: .red, radius: glowRadius)
                            .shadow(color: .red, radius: glowRadius)
                    }
                }
            }
        }
    }
}

Acknowledgements:


r/iOSDevelopment • • Jun 27 '22

Fresh news on in-app purchases from WWDC 2022. Collected all the important updates here.

Thumbnail
adapty.io
3 Upvotes

r/iOSDevelopment • • Jun 23 '22

How do you guys collect feedback from your users?

3 Upvotes

r/iOSDevelopment • • Jun 12 '22

Implementing a native calendar using UICalendarView in iOS16 and Swift

Thumbnail
ohmyswift.com
3 Upvotes

r/iOSDevelopment • • Jun 11 '22

Where can I find a comprehensive tutorial video/book to learn the basics of Xcode

3 Upvotes

r/iOSDevelopment • • Jun 09 '22

F = Respect for the devs in the trenches -- See comment if you want to team up on a game

Post image
3 Upvotes

r/iOSDevelopment • • May 09 '22

Is there a way to rent a MacBook online so I can compile and test my flutter app? I mean a remote workstation or something like that.

3 Upvotes

I don't own a MacBook but I have to write an app that runs on iOS and Android.


r/iOSDevelopment • • May 06 '22

How can I stand out as an iOS Dev?

3 Upvotes

I recently joined a pretty big company as an iOS Dev with a team of over 50 developers working on the one application. There’s been a lot of work to do and I’ve been learning so much. But this makes me think about my future and what I can do that can make me stand out or branch out from where I am right now?

Of course, eventually I can become a senior developer and there are positions above that that are more in line with management.

In terms of programming ability, a lot of people on my team have more experience/knowledge than me so learning and improving is one of my biggest priorities.

But when I think of future career paths I’m not too sure on what other skills I should be looking to add that can separate me from other devs we have.

Any advice would be greatly appreciated

Thank you


r/iOSDevelopment • • May 01 '22

Is there a way to programatically turn off Downtime on a child device?

3 Upvotes

I have a son with autism and ADHD, when he gets home from school he has some chores that he’s supposed to do before he can use the Xbox or his iPad. Unfortunately, he normally forgets and unless I’m standing next to him reminding him they don’t get done. I work from home, so I’m normally home when he gets from school, but I’m working and sometimes it meetings so I can’t always be beside him reminding him. I initially had a plan to add the jobs that he needs to do to his reminders app on his iPad, and using a smart wifi plug, cut power to his Xbox until all the tasks for the day were complete. The problem is, he doesn’t play the Xbox so often anymore and instead plays a game on his iPad so the smart plug won’t work. I was thinking that cutting the wifi to his iPad until the tasks are complete would be possible, but the game he plays isn’t dependent on the internet, so this wouldn’t help. I think Apple’s Downtime / Downtime on Demand would be ideal. I can schedule downtime to turn on, however that obviously won’t work for turning it off when his tasks are completed because that could take anywhere from 5 minutes to never depending on how evil he’s feeling that day ;-)

Some important (I think) things about this:

  • This isn’t about disciplining him for not doing his chores, but making it as easy as possible to remember to do them. He’s a sweet kid who genuinely wants to do the right thing, he just needs help remembering

  • I know there's holes in this process, he can just mark the tasks as complete without actually doing them, he can bypass the wifi smart plug, or just push the power button on it. He's a smart kid, he'll figure out all that quickly, and I have no intention of hiding it from him. This is about helping him do the 'right' thing, not stopping him from doing the 'wrong' thing.

  • I want him to get the instant reward of having his iPad unlocked / Xbox getting power as soon as he completes his tasks

Is anyone aware of a way that I can turn Downtime off programatically? I have a Mac, iPad and iPhone and can code. Is this something I could do with Apple Script? I’m also happy to subscribe to a service as long as it’s reasonable.

Some stuff I’ve tried:

  • I’ve found a python library called pyiCloud that works with some of the iCloud web services, but doesn’t include activating Downtime. I played around with it a bit and tried to guess the screen time / downtime url’s but didn’t have any luck.

  • I tried using Wireshark to figure out which URL is being called but my knowledge here is VERY limited and I couldn’t figure it out.

  • Apple shortcuts, but there doesn’t seem to be any integration with screen time or downtime controls

  • IFTTT - doesn’t have anything to work with screen time / downtime, but made my life easier by giving me the idea to use Reminders & Shortcuts instead of developing my own Task / Todo list app (I was looking for a project, and I like over engineering things…)

  • Back before Apple had screen time controls, I used to use an app called OurPact that essentially did the same thing that screen time / downtime does now, and it has a ‘Block’ command. They don’t have integration with Shortcuts, but I’m thinking I could potentially use this service, and hit the API to block from a script - I’d rather use the native options though, and I think the setup now is a bit more intrusive than I’d like, so I’m leaving this as an absolute last resort

  • I checked out the response in the network tab of the developer tools when logging in to iCloud and got a list of the webservices and URL’s, and there was nothing for screen time or downtime (reminders, notes, mail, ckdatabasews, photosupload, mcc, photos, drivews, uploadimagews, schoolwork, cksharews, findme, ckdeviceservice, iworkthumbnailws, calendar, docws, settings, premiummailsettings, ubiquity, streams, keyvalue, archivews, push, iwmb, iworkexportws, geows, account, & contacts)

  • The Screen Time framework only seems to be able to read the settings, and update settings for the current device rather than a child device. It would potentially be possible to write an app that he has on his iPad with the task list and disable downtime which probably wouldn't work because my account needs to send the request to turn off downtime, but I haven’t looked into what this API does too deeply to know whether this is possible - if anyone knows how this works, I would appreciate any advice.

Any advice anyone can offer on options and possibilities on how to implement this, I would greatly appreciate it!


r/iOSDevelopment • • Apr 03 '22

Developing an app to be compatible with iOS 9~now

3 Upvotes

I know a bit of Objective-C and have done a bit with Swift/SwiftUI. I wrote an app that I want to put on the daughter's iPad2 and it only supports up to iOS 9.35 (sadly). I wouldn't mind publishing it for free after I figure out if it can be developed/built to have support for older versions of iOS. I've searched our buddy Google and YouTube for info on doing this but haven't turned up anything substantial.


r/iOSDevelopment • • Mar 07 '22

Linkboard - An easy bookmarks manager

Thumbnail
apps.apple.com
3 Upvotes

r/iOSDevelopment • • Feb 23 '22

Supercharged app development using SwiftUI

Thumbnail
engineering.q42.nl
3 Upvotes

r/iOSDevelopment • • Feb 22 '22

Assets Hero - an easy icon maker

3 Upvotes

Hi devs :)

I created an application called Assets hero that helps you generate the different sized icons for App icons. It can be downloaded from App Store here.

In case you have any suggestions for it, please let me know. Also, since I don't want this to be a shameless promotion, if you like this application and find is useful, please DM me and I will give you a promo code for PRO version.


r/iOSDevelopment • • Jan 26 '22

How much can a person learn before their head explodes?

3 Upvotes

I work 10 hour days that are mentally demanding then spend a few more hours learning programming every night and I go to bed feeling like my head is going to literally explode.


r/iOSDevelopment • • Jan 02 '22

How to push a View Controller using a UITabBar?

Thumbnail
stackoverflow.com
3 Upvotes

r/iOSDevelopment • • Dec 25 '21

Receiving only iOS job offers in a Telegram channel.

3 Upvotes

Hi,

I've created a Telegram channel that publishes a lot of iOS offers every day, very useful if you are an iOS developer and looking for an opportunity. It only gets offers with salary.

iOS Telegram channel

Hope it helps


r/iOSDevelopment • • Dec 20 '21

Coffee Store UI in SwiftUI!!!

Post image
3 Upvotes

r/iOSDevelopment • • Sep 08 '21

Best iOS App Development Tools In 2021

3 Upvotes

These days, organizations tend to develop mobile apps and so ios app developers have been in demand. And also their pay scale increased even for beginners too. That’s why more and more individuals are turning towards ios app development. Regardless of whether you are a professional iOS developer or beginner knowing various resources and assets can improve your iOS development procedure. iOS development is not as complex as developing for other programming languages. There are lots of materials and tools available to develop an ios app but knowing the best tools will help you in rapid and effective development. If you are developer and going to build ios app, let’s have a look at the best tools for ios app development.

Know the amazing features of iOS 15 at- Top 11 New Features Of iOS 15

Best Ios App Development Tools In 2021–

1. UI/UX-

App design and structuring is a critical and impactful step  in mobile app development. Developers continually seek methods to make their apps more attractive and user-friendly. Here we’ve listed some important ios app design tools. 

1.1 Flawless (free)-

It is a great option for those who are looking for versatile iOS development tool which can help with ios app design comparison, analysis and execution. Also it comes with XCode that allows you to compare old device to new one very easily.

Features-

  • Check Motion and animation

  • Animated Screenshot capture

  • Dynamic Design generation

1.2 Haiku (Freemium)-

It is best for animated and interactive UI. Main goal of Haiku is to create homegrown content. As you design, code will automatically update your iOS apps. Each Haiku element is compatible with React, Vue and Web. It comes with a 7-Day free trial with price tag up to $ 459.84.

Features-

  • Rich animation features

  • Layouts

  • Team collaboration features

  • Multi/nested components

  • Drawing tools

1.3 Figma (Freemium)-

It is a design app which works with Chrome, Firefox, Safari and Edge browsers. And this makes it best design tool. It costs you nearly $12 to $45 per month and individual subscription allows you to try out for free too.

Features-

  • Multiplayer collaboration

  • Livesharee

  • Constraints

  • Team libraries

  • Components

  • Version control

  • Prototyping

2. IDEs And Editor-

2.1 AppCode-

It was created by JetBrains aiming to develop ios/macOS apps and supports many programming languages such as Swift, C++, Objective C, XML, CSS, HTML and Javascript. Also, it can support some testing units such as Google test testing systems. It helps in featuring the code issues with its smart code assistance.

2.2 Fabric-

It is one of the best iOS app development tools used by developers to build applications for different purposes. It includes some modular tool sets that can be merged to develop the desired apps. Fabric is very effective to use in app development process and allows designers to easily add more functions. 

2.3 Xcode-

It is the most flexible iOS app development software. This IDE is for macOS devices including some programming languages for app development that are compatible with iOS, iPad, macOS, watchOS and tvOS. XCode goes with a source code checker that examine the bugs and suggest changes while writing the codes. Developers require less time in coding because of the autocomplete usefulness and real-time fixtures.

3. Tools For Debugging-

Troubleshooting is an important part of app development. Here are two debugging tools Raygun and Parse. 

3.1 Raygun-

It is great for troubleshooting and debugging ios apps. It is an inline SDK which offers smart reporting in the development process. 

3.2 Parse-

Parse is an open-source platform that helps with wide database files for auto-scaling and mechanized reinforcements.

4. Backend Services-

4.1 Firebase (Free)-

It is a Baas (Backend-as-service) that is used as a worker and simultaneously used for API and datastore. With firebase, there is no reason for any backend code. Firebase allows you to store and sync information over the client’s progress.

4.2 Helios-

It is an open-source framework used for ios mobile app development which provides a collection of critical back-end services. Helios will help you in developing advanced features like data syncing, in-app purchases, push notifications, Passbook integration and analytics into your app.

5. Testing-

5.1 OCMock (Free)-

It is a testing framework for building stubs in iOS apps. Mock objects are important in software testing because it allows a QA engineer to  emulate the behavior of a complicated, real-world object. As Xcode lacks built-in support for mockup objects, OCMock is a kind of library. This library supports Objective-C and allows users to add mock objects to existing test cases. 

Features-

  • Easily add Mock Objects

  • Open Source

  • Compatible with C

  • Easily add Mock Objects

5.2 XCTest and XCUITest (Free)-

XCTest and XCUITest are frameworks by Apple which are shipped with XCode to test iOS apps. XCUITest is a user interface testing framework built on XCTest. It has additional class for better UI testing. Users can create test case in Objective C and Swift too. And these test scripts are packed in a test IPA runner. Then this IPA runner executes the test scripts on application under test.

Features-

  • Increased reliability

  • Operates directly on Object level

  • Easy for developers

  • Better Framework architecture & Faster execution

6. Game Development-

6.1 Unity (Freemium)-

It is a top mobile development engine launched by unity technologies and helps to create game using 2D and 3D features. Also, with Unity, you can work with team and import assets from many 3D apps like Blender. It offers you a wide range of assets that can be purchased from its store. It has guides and tutorials and so it is most popular tool among developers community.

Supported Platform-

  • Tizen OS

  • Fire OS

  • iOS

  • Android

  • Windows

Pricing-

  • Free for personal use and students

  • Plus Plan $40/ month

  • Pro Plan $150/ month

6.2 SpriteKit – 2D sprite-based games (Free)-

It is Apple’s proprietary game engine used to create 2D games. It supports both Objective C and swift. If you’re going to make an Apple game, this platform is for you. Always keep in mind that, if it’s Apple-supported, you won’t need to download any extra libraries or sources, and you can be sure that it complement and perfectly suit all Apple’s new products. Some of the popular games developed with SpriteKit are- Trestle, Accelebot, Squashy Bug.

Pricing

  • Free

7. Analytics Tools-

7.1 UXCam App Analytics-

It is a user session recording based analytics tool for mobile applications. You can study user’s behavior in depth with this app. Heatmaps can be used to determine which functions in app are least and most used. 

Features-

  • Find issues

  • Analyze heatmaps

  • Automatic elegant tagging

Price-

  • Free trial

  • Price upon request

7.2 Flurry (Free) –

It is a free mobile analytic tool launched by Yahoo in 2018. It allows you to track sessions, installs and run-on demand analysis for funnels. Also you can detect bugs from crash reports.

Features-

  • Free app analytics

  • Events

  • Funnels

  • Segments

  • Cohorts

Price

  • Free trial


r/iOSDevelopment • • Aug 24 '21

Customizing UIButton in iOS 15

Thumbnail
ohmyswift.com
3 Upvotes

r/iOSDevelopment • • Apr 19 '20

I created a simple iOS app to track teddy bears

Thumbnail
apps.apple.com
3 Upvotes

r/iOSDevelopment • • Apr 04 '20

How to start, or better yet what to learn?

3 Upvotes

Hello,

I have never done any app development. I know some HTML, CSS and JS and can make a basic website but that's it. Now I want to try to do a simple little app for the iPhone. I was wondering since I know HTML, CSS and JS is it better to use PhoneGap or something similar, or is it better not to use a platform and code it with Xcode and Swift? I don't have a lot of knowledge but It would seem that making with Phonegap would be easier and I wouldn't need to learn a new language. But then again, in the long run, It may be more useful to know how to code for native IOS apps and learn objective-C. Is PhoneGap cutting corners, and are the apps considered worse? What path offers more on the side money, considering that I would like it?


r/iOSDevelopment • • Mar 21 '20

Looking for mentor!

3 Upvotes

Hi, I am a sophomore in college right now majoring in Computer Science. I recently began learning Swift and IOS development. Before this I was learning full stack web development, flutter, and machine learning. I built a simple app which took me 6 months because I was so inexperienced and naive, link is here if your interested to see what it is: dreamcheck.co. I am extremely hard working, but I just need guidance for example I do not know whether or not to continue to stick with learning UIKit or to change over and learn SwiftUI. Another example would be, should I study the documentation from time to time? What kind of projects should I build to get better, faster. I want to work hard but also smart. If there is any person who is willing to help me I would greatly appreciate it! My dream in the future is to start my own software/AI company.


r/iOSDevelopment • • Jan 16 '20

Is it possible to push custom firmware to AirPods Pro?

3 Upvotes

seed sink beneficial imagine puzzled aspiring ring domineering fearless lush

This post was mass deleted and anonymized with Redact


r/iOSDevelopment • • Nov 17 '19

Creating iOS Comic Book App - How To Use JSONDecoder

Thumbnail
youtu.be
3 Upvotes

r/iOSDevelopment • • Oct 28 '19

Amateur hour: Apple releases iOS 13.2 and does not release Xcode 11.2? There is no way to test apps on the device. So, don't update your iOS device yet.

3 Upvotes