#objC
Explore tagged Tumblr posts
Text


yeah. objc shoe.
#tpot#bfb#bfdi#bfdia#firey bfb#two tpot#gaty tpot#leafy bfb#teardrop tpot#teardrop bfb#gaty x two#twogaty#gatytwo#sorry. love them#router.jpeg
240 notes
·
View notes
Text
Augmented Reality App Development Using ARKit
Augmented Reality (AR) has transformed the way users interact with the digital world, blending virtual elements with the real environment. ARKit, Apple's powerful framework for AR development, provides developers with the tools they need to create immersive AR experiences on iOS devices. This post will guide you through the basics of ARKit, its features, and how to get started with AR app development.
What is ARKit?
ARKit is a framework developed by Apple that enables developers to create augmented reality applications for iOS. It uses advanced computer vision and device motion tracking to integrate virtual content into the real world seamlessly. ARKit is designed to work with iPhone and iPad devices, making it accessible to a wide range of users.
Key Features of ARKit
Motion Tracking: Tracks the device's position and orientation in 3D space.
Environmental Understanding: Detects flat surfaces, such as tables or floors, to place virtual objects accurately.
Light Estimation: Adjusts the lighting of virtual objects to match the real-world environment.
Face Tracking: Recognizes and tracks facial features, enabling immersive experiences like filters or animations.
AR Anchors: Allows you to place virtual objects in the real world and keep them in place as the user moves around.
Getting Started with ARKit
Set Up Your Development Environment:
Install Xcode, Apple's integrated development environment (IDE).
Create a new project and choose the "Augmented Reality App" template.
Choose a Programming Language: ARKit supports both Swift and Objective-C. Swift is recommended for new projects.
Familiarize Yourself with ARKit API: Explore the ARKit documentation to understand key classes like ARSession, ARConfiguration, and ARAnchor.
Basic Example: Creating a Simple AR App
This example shows how to create a simple AR app that places a virtual cube on a detected flat surface:import UIKit import ARKit class ViewController: UIViewController, ARSCNViewDelegate { @IBOutlet var sceneView: ARSCNView override func viewDidLoad() { super.viewDidLoad() sceneView.delegate = self sceneView.showsStatistics = true let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapScreen)) sceneView.addGestureRecognizer(tapGesture) let configuration = ARWorldTrackingConfiguration() configuration.planeDetection = [.horizontal] sceneView.session.run(configuration) } @objc func didTapScreen(gesture: UITapGestureRecognizer) { let location = gesture.location(in: sceneView) let hitTestResults = sceneView.hitTest(location, types: .existingPlaneUsingExtent) if let result = hitTestResults.first { let cube = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0) let material = SCNMaterial() material.diffuse.contents = UIColor.red cube.materials = [material] let cubeNode = SCNNode(geometry: cube) cubeNode.position = SCNVector3(result.worldTransform.columns.3.x, result.worldTransform.columns.3.y + 0.05, result.worldTransform.columns.3.z) sceneView.scene.rootNode.addChildNode(cubeNode) } } }
Best Practices for AR Development
Optimize 3D Models: Keep the polygon count low for better performance.
Test on Real Devices: Always test AR experiences on actual iOS devices for accurate performance.
Consider User Experience: Provide clear instructions for users on how to interact with the AR elements.
Leverage Lighting: Use realistic lighting to enhance the integration of virtual objects into the real world.
Advanced Features to Explore
Image Tracking: Recognize and track images in the environment.
Object Detection: Place virtual objects based on recognized physical objects.
Face Tracking: Utilize ARKit's face tracking capabilities for interactive experiences.
Multi-user Experiences: Implement shared AR experiences where multiple users can interact in the same virtual space.
Conclusion
ARKit provides developers with a robust framework for creating immersive augmented reality experiences on iOS. By leveraging the powerful features of ARKit, you can build innovative applications that engage users in new and exciting ways. Start exploring ARKit today and be part of the future of technology!
0 notes
Text
To make a Swift required init for an ObjC class, put the init in a protocol:
@protocol PSPDFDocumentCreation <NSObject> - (instancetype)initWithThing:(NSThing)thing; @end @interface PSPDFDocument: NSObject <PSPDFDocumentCreation> @end
Thanks Kostiantyn Herasimov for pointing this out.
0 notes
Text
macOS Sequoia to Allow iCloud Logins in Virtual Machines on ARM Macs
https://developer.apple.com/documentation/virtualization/using_icloud_with_macos_virtual_machines?language=objc
0 notes
Photo

#純靠北工程師7nn
----------
嚴重警告:NSMenu.items 在 macOS 10.13 為止的系統下是唯獨的!! 往這個 property 裡面直接寫東西會導致整個視窗叫不出來!!! 然後你在 console 裡面會看到 [NSMenu setItemArray:]: unrecognized selector sent to instance。 這麼個重要的事項,都寫在 NSMenu 的 objc header 裡面了。 但 Xcode 15 的 documentation team 這群吃屎長大的居然沒有寫。 Xcode 15 正式版問世到現在多少個月了?為什麼到現在都還有能在 macOS 10.13 系統下發作的弱智錯誤?
----------
💖 純靠北工程師 官方 Discord 歡迎在這找到你的同溫層!
👉 https://discord.gg/tPhnrs2
----------
💖 全平台留言、文章詳細內容
👉 https://init.engineer/cards/show/9923
0 notes
Text
Saturday Morning Coffee
Good morning from Charlottesville, Virginia! ☕️
I’m still having a great time at work integrating React Native into an existing iOS App. I still have a lot to learn about JavaScript and TypeScript but my interest is piqued. Don’t get me wrong, I still need to learn SwiftUI and I still love doing native work, but this is worth learning because we’re seeing more clients ask for it.
Just poured my first cup. I hope you enjoy the links.
Alan Herrera • Comic Sands
The United States Forest Service responded to a video filmed by a couple that went viral for allegedly showing Bigfoot walking in broad daylight.
I really do wish Bigfoot was a real thing. The skeptic in me says “Of course this is faked.” But how do we really know?
The truth is out there.🛸
Steven Lee Myers, Stuart A. Thompson and Tiffany Hsu • The New York Times
Now rebranded as X, the site has experienced a surge in racist, antisemitic and other hateful speech. Under Mr. Musk’s watch, millions of people have been exposed to misinformation about climate change. Foreign governments and operatives — from Russia to China to Hamas — have spread divisive propaganda with little or no interference.
Face it, Space Karen isn’t the genius everyone made him out to be. He’s a self serving narcissist with too much money and strange ideas.
I’ve been saying I won’t call X, X, because it’s still Twitter. I’m wrong. Twitter is gone. Now folks are left with X.
Please, please, please, sell the Twitter name and branding. Someone could make something amazing with it. 🐦
Swift Forums
When using this feature, the developer hand-writes Objective-C headers just as they normally would for an Objective-C class, but implements their declarations in Swift by using an extension marked with the new @implementation attribute.
This is an interesting idea but I’m not sure it’s any better than what we have today when using @objc notation.
I suppose it would mean the continued existence of the vaunted header file. 😄
Dave Winer
I have basically had it with JavaScript. It is a write-only language. More so than any other language I’ve used, including some pretty old and arcane systems. I asked ChatGPT to give DALL-E instructions based on this prompt.
Even if you don’t read Dave’s piece go check out the images generated by DALL-E. They’re beautiful works of art suitable for framing. Seriously.
Steven Beschloss
Twice now President Joe Biden made the decision to visit active war zones not under U.S. military command. These trips, to Kyiv in February and to Tel Aviv this week, are without precedent in modern American history. It’s easy to take these visits in stride: It’s the President of the United States! Surely, he has quite a circle of protection. But I think it’s worth reflecting on the vigor and guts—and principle—it took to meet American allies in person to demonstrate American support, despite genuine danger.
Joe Biden has been a great President. I don’t care if he’s “too old” to hold the office. He seems to be doing a pretty damned good job of it. 🇺🇸
Paul Thurrott
Crapware. PC makers have long installed crapware and other superfluous utilities in Windows, providing users with a compromised user experience that didn’t reflect what Microsoft intended. But with Windows 11, now Microsoft installs its own collection of crapware too, in the form of sponsored apps and shortcuts in the Start menu.
Seriously Microsoft? Some of your own software includes ads? That’s pathetic.
At least Apple’s annoying notifications for services are a little better, not by much, but slightly better. 🤬
Detroit Free Press
A politically connected Detroit synagogue president was found stabbed to death Saturday morning outside her home in the city’s Lafayette Park neighborhood, east of downtown.
If you think the war in Gaza and Israel don’t affect us at home, think again.
Hate crimes in the States will most likely continue to climb because of it. 😢
Chance Miller, Ben Lovejoy, Zac Hall, and Michael Potuck • 9 to 5 Mac
Is M. Night Shyamalan running Apple? The company just announced a Monday night keynote event on the eve of Halloween. The tagline? Scary Fast. Macs are rumored, but what Apple silicon will be inside?
How long have M2 Macs been a thing? I haven’t got a clue. Is the M3 a Halloween surprise just in time for the holiday season? 🤔
Joseph Heck
Over the summer, I started working with the Automerge team to bring its Rust-language core to Swift.
Joseph is a really nice guy and I’m excited to see him working on something he’s so passionate about. I’ll be keeping an eye on his progress. 🦀
Witney Seibold • /Film
Halloween’s Original Movie Poster Has A Creepy Hidden Detail - And It Happened By Accident
It took me a while to make out what they’re talking about. Go see for yourself.
Sindre Sorhus
Buffer will never be removed, and probably never even deprecated, but at least the community can slowly move away from it. My hope is that the Node.js team will at least start discouraging the use of Buffer.
I know nothing about JavaScript but it’s always nice to see someone advocate for making code safer.
Do you use Buffer in your code? Maybe it’s time to change that? 🦬
1Password Blog
How ethical hacker Jamie Woodruff used a pizza delivery to break into a server room
This made me think of the 1992 film, Sneakers. If you haven’t seen it, go watch it. It’s a great film. 👟
I’d be horrible security for a data center. Pizza? You have pizza? Sure, come on in! 🍕
Victor Tangermann • Futurism
AI chatbots like OpenAI’s ChatGPT and Google’s Bard consume an astronomical amount of electricity and water — or, more precisely, the massive data centers that power them do.
The crypto and AI data centers really need to get their act together and start building sources of clean energy to power these monstrosities.
Andy Greenberg • WIRED
They Cracked the Code to a Locked USB Drive Worth $235 Million in Bitcoin. Then It Got Weird
This is a cool story! Again, I think of Sneakers.
I hope this means folks who forgot their passwords are able to crack their keys open and sell off their bitcoin.
Especially the poor dude who has millions in bitcoin. He’s not using this tech, currently, but I hope he’s able to finally be able to cash out. 💸
Marc Elias • Democracy Docket
Republican lawyers are back in the news and are bringing disgrace to the party and profession. Even before the indictments in Georgia, it had been widely reported that at least five, and perhaps all six, of former President Donald Trump’s co-conspirators were Republican lawyers. Now in Georgia, we add several lawyers, some familiar and some new, to the list of Trump’s co-defendants.
At least some of these knuckleheads are pleading guilty and cooperating.
I still say his Orangness will get off scot-free. He’ll delay, delay, delay. Win the Presidency. Pardon everyone he can, destroy democracy, and not leave the White House until he’s dead.
If things get super bad I hope Canada and Mexico will accept American refugees.
Dave Rogers
Sea level rise is a game of inches. It doesn’t take many inches to create miles and miles and miles of problems. And it’s going to take decades to address those problems, so we might as well get started now.
Yay, climate change! 😡
If the Orangeman doesn’t destroy the nation, climate change might.
Dave, we won’t cleanup things on the shoreline. We’ll just let Mother Nature take it and leave a giant mess. Like we do. 😔
Christopher Nichols • Atlas Obscura
One of the reasons people can never be entirely sure about what is going on at Area 51 is that it is a highly classified secret military facility. It was not until 2013 that the United States government even acknowledged the existence and name “Area 51.”
I like this take on Area 51. We don’t need aliens to create crazy technology.
I do like the thought of aliens though. 👽
Daring Fireball
This “now is not the time” argument gets trotted out by Republicans after each and every gun massacre. Right after their tweets offering “thoughts and prayers”. Bullshit. The aftermath of a massacre is the time to demand sane gun control measures.
Yep. More pressure to pass great gun legislation. It’s time for a nationwide ban on assault weapons and other protections.
0 notes
Text
optional protocol methods
original source : https://www.hackingwithswift.com/example-code/language/how-to-make-optional-protocol-methods
두가지 방법이 있다.
1.
2.
0 notes
Text
Week 178
TestFlight was updated with some pretty cool features
Goodies is almost 3 years old. We have a huge support from people in our github, and for that: Thank you. However, we would like to evolve goodies so we need another kind of support. That is why we created a patreon account.
Supporters
This edition was sponsored by @phelgo and Adriano Gonçalves
Articles
Handling non-optional optionals in Swift, by @johnsundell
Using protocol compositon for dependency injection, by @merowing_
VisualKit: creating a UI Framework, by @victorbaro
Analysis of the Facebook.app for iOS, by @timacfr
100% Coverage of Edge Cases: How to Safely Parse JSON, by @qcoding
Tools/Controls
Nora, by @SD10
Selenops, by @zntfdr
MBIcons, by @Cornel_Viorel
EmojiIntelligence, by @Reffas_Bilal, Luubra
SquishButton, by @BalestraPatrick
Business
70ish Life and Business Lessons for Designers, by @hemeon
For programmers, the ultimate office perk is avoiding the office entirely, by @onyxfish
UI/UX
How United Onboards New Users, by @samuelhulick
Design principle: Consistency, by @ainikolov
Interesting Takes on Log in / Sign Up Forms, by @chriscoyier
Is the Floating Action Button Bad UX Design? by Tom Jager
Videos
Git at Scale: Managing Swift/Obj-C Code & Coders, by @asparagui
Credits
SD10, OrenID, naeemshaikh90, LisaDziuba, mariusc, rbarbosa
3 notes
·
View notes
Text
[OBJ-C] set Frame not working
[view setFrame:CGRect(0,0,200,300)]; If the above line is not doing what you want it’s probably because the parent view is autolaying out the child views. To manually setup the frame of a view you can: Set the view after the layout:
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
//ADD YOUR CODE TO SET THE FRAME MANUALLY
//for example:
[view setFrame:CGRectMake(0, 0, 200, 200)]; }
Or you can disable the auto layout of a single view: view.translatesAutoresizingMaskIntoConstraints = YES;
1 note
·
View note
Text
Scheduling Work in Swift using `NSTimer`
NSTimer can be used to perform scheduled work in Swift. Sometimes it is simpler than other options like GCD (Grand Central Dispatch) or NSOperationQueue, particularly if what you are scheduling needs to run on the main UI thread to access UIView instances anyway. There are also more options coming in the future such as Actors.
Here is an example of using NSTimer running a block of code five times, one second apart:
import Foundation import PlaygroundSupport import UIKit let maxRepeats = 5 var currentRepeats = 0 let blockTimerWith5Runs = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in currentRepeats += 1 print("Block ran \(currentRepeats) times(s)!") if (currentRepeats >= maxRepeats) { timer.invalidate() } }
In an iOS app, RunLoop.main will already be running. In XCode playgrounds you also need:
RunLoop.main.run(until: Date(timeIntervalSinceNow: 6))
Output:
Block ran 1 times(s)! Block ran 2 times(s)! Block ran 3 times(s)! Block ran 4 times(s)! Block ran 5 times(s)!
It can also be used to run a function:
class FunctionTimerExample { init() { Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.peep), userInfo: nil, repeats: false) } @objc func peep() { print("Function ran once!") } } let functionTimerExample = FunctionTimerExample() RunLoop.main.run(until: Date(timeIntervalSinceNow: 2))
Output:
Function ran once!
The function can optionally receive the Timer itself as an argument with some user info attached:
class Counter { var count : Int init(_ count: Int) { self.count = count } } class FunctionTimerWithArgExample { init() { let userInfo = Counter(0) Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.peepArg), userInfo: userInfo, repeats: true) } @objc func peepArg(timer: Timer) { guard let userInfo = timer.userInfo as? Counter else { return } userInfo.count += 1 print("Function with arg ran \(userInfo.count) time(s)!") if (userInfo.count >= maxRepeats) { timer.invalidate() } } } let functionTimerWithArgExample = FunctionTimerWithArgExample() RunLoop.main.run(until: Date(timeIntervalSinceNow: 6))
Output:
Function with arg ran 1 time(s)! Function with arg ran 2 time(s)! Function with arg ran 3 time(s)! Function with arg ran 4 time(s)! Function with arg ran 5 time(s)!
An example use case is debouncing a search input
class DebouncedSearchViewController: UIViewController { var textField = UITextField(frame: CGRect(x: 20, y: 20, width: 200, height: 24)) var timer : Timer? override func viewDidLoad() { super.viewDidLoad() view.addSubview(textField) textField.placeholder = "Enter search" textField.backgroundColor = .green self.textField.addTarget( self, action: #selector(self.textFieldDidChange(textField:)), for: .editingChanged); } @objc func textFieldDidChange(textField: UITextField){ print("Text changed: " + textField.text!) timer?.invalidate() timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: false, block: { _ in guard let text = textField.text else { return } print("Submit debounced search query for: \(text)") }) } } let vc = DebouncedSearchViewController() vc.view.frame = CGRect(x: 0, y: 0, width: 300, height: 300) PlaygroundPage.current.needsIndefiniteExecution = true PlaygroundPage.current.liveView = vc.view
Demo of typing `ABC` quickly followed by `Z` after waiting for a second:
At one company I worked at, we found having a 500ms debounce instead of 200ms reduced the number of network calls, and thus reduced operational costs, without impacting user engagement. So there are debounce values you can use that will save things like cost, network bandwidth, and battery life without hurting user experience.
Warning: If doing some blocking operation like networking or file IO, make sure to start the timer off the main thread, or create a different run loop and add it to that run loop manually. Everything above runs on the main UI thread, so could lock up the user interface on the user if blocking operations were added.
2 notes
·
View notes
Note
Revvy sorry to ask something like this but I want to branch out from back-end to mobile, do you have any comprehensible resources or tips for it? I've heard Kotlin is the preferred path but I don't know much Java😞
Heyy, No problem Anon. I’m always happy to talk about coding. I’ll stick it under a cut though... cause it’s not smut.
In general I know that the actual google courses are quite good, which you can find here. If you find that those are maybe too easy, then you can look up more specific tutorials on Ray Wenderlich.
Personally, I’d recommend learning native (Java/Kotlin or ObjC/Swift) for whatever platform you’re interested in, because you can always easily pick up Xamarin or whatever else when you know how the platform basics work, but if all you learn is one of those ‘Javascript running on a phone’ type things, then you really don’t learn how apps work and how they’re put together, and that’s the bit that’s the most fun lol.
With regards to languages, in my experience most ‘professional’ level iOS projects will be mostly Swift, whereas Android stuff is still about half Java and half Kotlin, depending on the company.
With Android, Google is pushing Kotlin quite hard, and want it to be become the defacto Android language rather than Java. So if you wanna start with Android I’d recomend Kotlin, but if you’re more familliar with Java type languages (C# etc), then it might be easier to start with Java and then learn Kotlin later. Honestly, it’s more of a syntax change than anything else.
What’s most important to focus on is how apps are put together, what the frameworks are etc, rather than language specifics.
Because you mentioned you’re a back end developer, I also wanna add that there are loads of apps that do processing on the phone too, it’s not just all front end. I would be bored out of my mind if I was stuck just going UI work, so I make sure to look at companies where the apps are actually communicating with an external device, or doing data processing. This is stuff like IOT, wireless headphones, NFC, image processing etc. That way you still get to do actual coding and problem solving and the fun stuff, without being totally bogged down with UI work that gets super boring and repetative.
5 notes
·
View notes
Photo

#developers #russia #coding #moscow #windows #macos #watchos #tvos #ios #android #nodejs #serversideswift #objc #swift #c# - вот так всего по немногу в жизни, получается разработка полного цикла 😉
#macos#tvos#nodejs#windows#ios#moscow#coding#c#watchos#objc#serversideswift#android#developers#swift#russia
0 notes
Text
Metaprogramming Classes in JavaScript
Sometimes when defining very similar objects, it can make sense to generate them all at once. For example here is how 3 classes of similar functions can be generated from an array and a single class definitions:
const classTypes = ['A', 'B', 'C']; for (let type of classTypes) { global[`class${type}`] = class { [`describe${type}`]() { return `A class of type ${type}`; }; } } const objA = new classA(); console.log(objA.describeA()); // A class of type A const objB = new classB(); console.log(objB.describeB()); // A class of type B const objC = new classC(); console.log(objC.describeC()); // A class of type C
global should be whatever the top level value (or object) that you want to attach the classes too. So window for browsers. In most cases, method names would remain the same across all classes, but I wanted to demonstrate that like everything else, those can have a unique name directly input.
I could not find a direct compatibility table of the support for those dynamic method names, only general support tables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions#Browser_compatibility). So instead I verified the above works manually with window in the latest Chrome, Firefox, Safari and MS Edge in addition to Node 10+ with global.
Github Location https://github.com/Jacob-Friesen/obscurejs/blob/master/2019/metaClass.js
#classes#metaprogramming#object orientation#templating#es6#javascript#programming#web development#app development
33 notes
·
View notes